Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bus: bt1-axi: Use sysfs_streq instead of strncmp

There is a ready-to-use method to compare a retrieved from a sysfs node
string with another string. It treats both NUL and newline-then-NUL as
equivalent string terminations. So use it instead of manually truncating
the line length in the strncmp() method.

Link: https://lore.kernel.org/r/20200528145050.5203-6-Sergey.Semin@baikalelectronics.ru
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
Cc: Olof Johansson <olof@lixom.net>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: soc@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

authored by

Serge Semin and committed by
Arnd Bergmann
91920088 7f57416f

+2 -2
+2 -2
drivers/bus/bt1-axi.c
··· 220 220 * error while unaligned writing - the AXI bus write error handled 221 221 * by this driver. 222 222 */ 223 - if (!strncmp(data, "bus", 3)) 223 + if (sysfs_streq(data, "bus")) 224 224 readb(axi->qos_regs); 225 - else if (!strncmp(data, "unaligned", 9)) 225 + else if (sysfs_streq(data, "unaligned")) 226 226 writeb(0, axi->qos_regs); 227 227 else 228 228 return -EINVAL;