lkml.org 
[lkml]   [2020]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/4] spi: spidev_test: Check input_tx and input_file first after parse options
Hi Tiezhu,

On Thu, Feb 13, 2020 at 5:17 AM Tiezhu Yang <yangtiezhu@loongson.cn> wrote:
> It is better to check input_tx and input_file first after parse options.
> Otherwise, it will do some useless operations when both -p and --input
> are selected.
>
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

> --- a/tools/spi/spidev_test.c
> +++ b/tools/spi/spidev_test.c
> @@ -404,6 +404,9 @@ int main(int argc, char *argv[])
>
> parse_opts(argc, argv);
>
> + if (input_tx && input_file)
> + pabort("only one of -p and --input may be selected");
> +

Alternatively, this check could be moved to the end of parse_opts().

> fd = open(device, O_RDWR);
> if (fd < 0)
> pabort("can't open device");

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

\
 
 \ /
  Last update: 2020-02-13 09:26    [W:0.058 / U:1.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site