[PATCH 3/5] staging/wlags49_h2: correct check of the return value of register_netdev()

From: Stephan Gabert
Date: Mon Jun 16 2014 - 10:59:58 EST


As mentioned in net/core/dev.c register_netdev() explicitly returns a
negative errno code on failure.

So in case of failure, one should rather test whether ret is negative
than just unlike 0.

Signed-off-by: Stephan Gabert <stephan.gabert@xxxxxx>
Signed-off-by: Nicolas Pfeiffer <nicolas.pfeiffer@xxxxxx>
---
drivers/staging/wlags49_h2/wl_cs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlags49_h2/wl_cs.c b/drivers/staging/wlags49_h2/wl_cs.c
index c79f1ed..764f547 100644
--- a/drivers/staging/wlags49_h2/wl_cs.c
+++ b/drivers/staging/wlags49_h2/wl_cs.c
@@ -232,7 +232,7 @@ int wl_adapter_insert(struct pcmcia_device *link)

SET_NETDEV_DEV(dev, &link->dev);
ret = register_netdev(dev);
- if (ret != 0) {
+ if (ret < 0) {
printk("%s: register_netdev() failed\n", KBUILD_MODNAME);
goto failed;
}
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/