Skip to content

Commit b7cb430

Browse files
fancerarndb
authored andcommitted
bus: bt1-apb: 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 75341b3 commit b7cb430

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/bus/bt1-apb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ static ssize_t inject_error_store(struct device *dev,
325325
* Either dummy read from the unmapped address in the APB IO area
326326
* or manually set the IRQ status.
327327
*/
328-
if (!strncmp(data, "nodev", 5))
328+
if (sysfs_streq(data, "nodev"))
329329
readl(apb->res);
330-
else if (!strncmp(data, "irq", 3))
330+
else if (sysfs_streq(data, "irq"))
331331
regmap_update_bits(apb->regs, APB_EHB_ISR, APB_EHB_ISR_PENDING,
332332
APB_EHB_ISR_PENDING);
333333
else

0 commit comments

Comments
 (0)