]> git.karo-electronics.de Git - linux-beck.git/commitdiff
spi: spidev_test: Fix input file check when transferring file
authorMichal Vokáč <vokac.m@gmail.com>
Fri, 4 Nov 2016 10:30:03 +0000 (11:30 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 4 Nov 2016 15:56:09 +0000 (09:56 -0600)
Check the input file fd instead of spidev fd.
The spidev fd is supposed to be OK otherwise the transfer_file() function
would not be called at all.

Signed-off-by: Michal Vokáč <vokac.m@gmail.com>
Reviewed-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
tools/spi/spidev_test.c

index f046b77cfefe3056a72b82aa2194eb55e8b2fa93..816f119c9b7b1584a587077a55e28691418ff706 100644 (file)
@@ -315,7 +315,7 @@ static void transfer_file(int fd, char *filename)
                pabort("can't stat input file");
 
        tx_fd = open(filename, O_RDONLY);
-       if (fd < 0)
+       if (tx_fd < 0)
                pabort("can't open input file");
 
        tx = malloc(sb.st_size);