Commit a1df271a authored by YueHaibing's avatar YueHaibing Committed by Greg Kroah-Hartman

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: default avatarYueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20191107143223.44696-1-yuehaibing@huawei.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2a51470f
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment