projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2a51470
)
staging: hp100: Use match_string() helper to simplify the code
author
YueHaibing
<yuehaibing@huawei.com>
Thu, 7 Nov 2019 14:32:23 +0000
(22:32 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Tue, 10 Dec 2019 09:34:45 +0000
(10:34 +0100)
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>
drivers/staging/hp/hp100.c
patch
|
blob
|
history
diff --git
a/drivers/staging/hp/hp100.c
b/drivers/staging/hp/hp100.c
index 6ec78f5c602f6c44cc40285480db17fc058dafc1..e2f0b58e5dfd710c6dc9898e363a7acd0abadfd1 100644
(file)
--- a/
drivers/staging/hp/hp100.c
+++ b/
drivers/staging/hp/hp100.c
@@
-339,14
+339,11
@@
static __init int hp100_isa_probe1(struct net_device *dev, int ioaddr)
if (sig == NULL)
goto err;
- for (i = 0; i < ARRAY_SIZE(hp100_isa_tbl); i++) {
- if (!strcmp(hp100_isa_tbl[i], sig))
- break;
-
- }
+ i = match_string(hp100_isa_tbl, ARRAY_SIZE(hp100_isa_tbl), sig);
+ if (i < 0)
+ goto err;
- if (i < ARRAY_SIZE(hp100_isa_tbl))
- return hp100_probe1(dev, ioaddr, HP100_BUS_ISA, NULL);
+ return hp100_probe1(dev, ioaddr, HP100_BUS_ISA, NULL);
err:
return -ENODEV;