]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: fbtft: Replace magic number with constant
authorTobin C. Harding <me@tobin.cc>
Wed, 15 Feb 2017 03:27:24 +0000 (14:27 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Mar 2017 08:16:59 +0000 (09:16 +0100)
Current call to strncmp() uses a magic number. There is a compile
time constant defined for this buffer, included and used already at
other sites in the file.

Remove magic number. Replace with pre-existing compile time constant.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fbtft_device.c

index 6b9e8adda984d77a5af756570370245c6258e1bd..61b7bfc7d714c4f342d4aeb1d5a95860a31a1548 100644 (file)
@@ -1489,7 +1489,7 @@ static int __init fbtft_device_init(void)
        }
 
        for (i = 0; i < ARRAY_SIZE(displays); i++) {
-               if (strncmp(name, displays[i].name, 32) == 0) {
+               if (strncmp(name, displays[i].name, SPI_NAME_SIZE) == 0) {
                        if (displays[i].spi) {
                                spi = displays[i].spi;
                                spi->chip_select = cs;