Skip to content

Commit 9192008

Browse files
fancerarndb
authored andcommitted
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/[email protected] Signed-off-by: Serge Semin <[email protected]> Cc: Alexey Malahov <[email protected]> Cc: Olof Johansson <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: [email protected] Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 7f57416 commit 9192008

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/bus/bt1-axi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ static ssize_t inject_error_store(struct device *dev,
220220
* error while unaligned writing - the AXI bus write error handled
221221
* by this driver.
222222
*/
223-
if (!strncmp(data, "bus", 3))
223+
if (sysfs_streq(data, "bus"))
224224
readb(axi->qos_regs);
225-
else if (!strncmp(data, "unaligned", 9))
225+
else if (sysfs_streq(data, "unaligned"))
226226
writeb(0, axi->qos_regs);
227227
else
228228
return -EINVAL;

0 commit comments

Comments
 (0)