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

Configure Feed

Select the types of activity you want to include in your feed.

staging: hp100: Use match_string() helper to simplify the code

match_string() returns the array index of a matching string.
Use it instead of the open-coded implementation.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20191107143223.44696-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

YueHaibing and committed by
Greg Kroah-Hartman
a1df271a 2a51470f

+4 -7
+4 -7
drivers/staging/hp/hp100.c
··· 339 339 if (sig == NULL) 340 340 goto err; 341 341 342 - for (i = 0; i < ARRAY_SIZE(hp100_isa_tbl); i++) { 343 - if (!strcmp(hp100_isa_tbl[i], sig)) 344 - break; 342 + i = match_string(hp100_isa_tbl, ARRAY_SIZE(hp100_isa_tbl), sig); 343 + if (i < 0) 344 + goto err; 345 345 346 - } 347 - 348 - if (i < ARRAY_SIZE(hp100_isa_tbl)) 349 - return hp100_probe1(dev, ioaddr, HP100_BUS_ISA, NULL); 346 + return hp100_probe1(dev, ioaddr, HP100_BUS_ISA, NULL); 350 347 err: 351 348 return -ENODEV; 352 349