mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephan Gabert <stephan.gabert@fau.de>
To: pe1dnn@amsat.org, gregkh@linuxfoundation.org
Cc: nicolas.pfeiffer@fau.de, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, linux-kernel@i4.cs.fau.de,
	Stephan Gabert <stephan.gabert@fau.de>
Subject: [PATCH 3/5] staging/wlags49_h2: correct check of the return value of register_netdev()
Date: Mon, 16 Jun 2014 16:50:51 +0200	[thread overview]
Message-ID: <1402930253-32537-4-git-send-email-stephan.gabert@fau.de> (raw)
In-Reply-To: <1402930253-32537-1-git-send-email-stephan.gabert@fau.de>

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@fau.de>
Signed-off-by: Nicolas Pfeiffer <nicolas.pfeiffer@fau.de>
---
 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


  parent reply	other threads:[~2014-06-16 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16 14:50 [PATCH 0/5] staging/wlags49_h2: fixed up wl_cs.c Stephan Gabert
2014-06-16 14:50 ` [PATCH 1/5] staging/wlags49_h2: checkpatch: including <linux/*.h> instead of <asm/*.h> Stephan Gabert
2014-06-16 14:50 ` [PATCH 2/5] staging/wlags49_h2: checkpatch: added spaces around equal sign Stephan Gabert
2014-06-16 14:50 ` Stephan Gabert [this message]
2014-06-16 18:49   ` [PATCH 3/5] staging/wlags49_h2: correct check of the return value of register_netdev() Dan Carpenter
2014-06-16 14:50 ` [PATCH 4/5] staging/wlags49_h2: convert printk calls to netdev_* calls Stephan Gabert
2014-06-16 14:50 ` [PATCH 5/5] staging/wlags49_h2: checkpatch: line over 80 characters Stephan Gabert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402930253-32537-4-git-send-email-stephan.gabert@fau.de \
    --to=stephan.gabert@fau.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@i4.cs.fau.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.pfeiffer@fau.de \
    --cc=pe1dnn@amsat.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®