linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Greg KH <greg@kroah.com>
Cc: Pavel Machek <pavel@suse.cz>,
	Sandro Bonazzola <sandro.bonazzola@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] w35und: fix usb_control_msg() error handling in wb35_probe()
Date: Fri, 30 Jan 2009 11:32:47 +0200	[thread overview]
Message-ID: <1233307967.13655.30.camel@penberg-laptop> (raw)
In-Reply-To: <20090129192423.GC31847@kroah.com>

On Thu, 2009-01-29 at 11:24 -0800, Greg KH wrote:
> Hm, it doesn't apply to the latest -next tree, care to respin it?

Here you go:

>From 0d8febfea5c6f2a608584328771eba72df7c5806 Mon Sep 17 00:00:00 2001
From: Pekka Enberg <penberg@cs.helsinki.fi>
Date: Fri, 30 Jan 2009 11:29:27 +0200
Subject: [PATCH] w35und: fix usb_control_msg() error handling in wb35_probe()

If successful, the usb_control_msg() function returns the number of
bytes transferred. Fix up wb35_probe() to only bail out if the function returns
a negative number. Also, fix up ieee80211_alloc_hw() error code to ENOMEM;
otherwise GCC complains that err might be undefined (and is right about that).

Acked-by: Pavel Machek <pavel@suse.cz>
Reported-and-tested-by: Sandro Bonazzola <sandro.bonazzola@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 drivers/staging/winbond/wbusb.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c
index 3f7d4e5..69b4ed0 100644
--- a/drivers/staging/winbond/wbusb.c
+++ b/drivers/staging/winbond/wbusb.c
@@ -319,16 +319,18 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
 	struct usb_device *udev = interface_to_usbdev(intf);
 	struct wbsoft_priv *priv;
 	struct ieee80211_hw *dev;
-	int err;
+	int nr, err;
 
 	usb_get_dev(udev);
 
 	// 20060630.2 Check the device if it already be opened
-	err = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ),
-			      0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN,
-			      0x0, 0x400, &ltmp, 4, HZ*100 );
-	if (err)
+	nr = usb_control_msg(udev, usb_rcvctrlpipe( udev, 0 ),
+			     0x01, USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_DIR_IN,
+			     0x0, 0x400, &ltmp, 4, HZ*100 );
+	if (nr < 0) {
+		err = nr;
 		goto error;
+	}
 
 	ltmp = cpu_to_le32(ltmp);
 	if (ltmp) {  // Is already initialized?
@@ -337,8 +339,10 @@ static int wb35_probe(struct usb_interface *intf, const struct usb_device_id *id
 	}
 
 	dev = ieee80211_alloc_hw(sizeof(*priv), &wbsoft_ops);
-	if (!dev)
+	if (!dev) {
+		err = -ENOMEM;
 		goto error;
+	}
 
 	priv = dev->priv;
 
-- 
1.5.4.3




      reply	other threads:[~2009-01-30  9:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-22 10:06 [PATCH] w35und: fix usb_control_msg() error handling in wb35_probe() Pekka J Enberg
2009-01-22 11:42 ` Pavel Machek
2009-01-22 19:25   ` Sandro Bonazzola
2009-01-22 21:10     ` Pavel Machek
2009-01-22 21:19       ` Harvey Harrison
2009-01-22 22:32         ` Pekka Enberg
2009-01-22 22:34       ` Sandro Bonazzola
2009-01-22 22:31         ` Pekka Enberg
2009-01-26 19:31           ` Sandro Bonazzola
2009-01-26 19:40             ` Pekka Enberg
2009-01-26 19:43               ` Pekka Enberg
2009-01-26 20:13                 ` Sandro Bonazzola
2009-01-26 20:22                   ` Pekka Enberg
2009-01-26 21:42             ` Pavel Machek
2009-01-22 22:37     ` Pekka Enberg
2009-01-26 17:51 ` Greg KH
2009-01-26 18:03   ` Pekka Enberg
2009-01-26 18:10     ` Pekka Enberg
2009-01-29 19:24       ` Greg KH
2009-01-30  9:32         ` Pekka Enberg [this message]

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=1233307967.13655.30.camel@penberg-laptop \
    --to=penberg@cs.helsinki.fi \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=sandro.bonazzola@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).