summaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/whci
diff options
context:
space:
mode:
authorDan Carpenter2012-07-20 08:58:16 +0200
committerGreg Kroah-Hartman2012-08-16 00:17:39 +0200
commit3821bf4abb7f78c90af7fa2975df6618906b11ec (patch)
tree4ac3fbae82c1d034713ecf31b3c34479fb98b6fc /drivers/usb/host/whci
parentUSB: legousbtower.c: remove a bogus NULL check (diff)
downloadkernel-qcow2-linux-3821bf4abb7f78c90af7fa2975df6618906b11ec.tar.gz
kernel-qcow2-linux-3821bf4abb7f78c90af7fa2975df6618906b11ec.tar.xz
kernel-qcow2-linux-3821bf4abb7f78c90af7fa2975df6618906b11ec.zip
USB: whci-hcd: fix NULL dereference on allocation failure
If usb_create_hcd() fails here then we dereference "whc" inside the call to whc_clean_up() before it has been set. The compiler would have warned about this if we hadn't initialized all the pointers to NULL at the start of the function. I've cleaned that up as well. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/whci')
-rw-r--r--drivers/usb/host/whci/hcd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/host/whci/hcd.c b/drivers/usb/host/whci/hcd.c
index 1e141f755b26..c3a647816af0 100644
--- a/drivers/usb/host/whci/hcd.c
+++ b/drivers/usb/host/whci/hcd.c
@@ -238,16 +238,16 @@ static struct hc_driver whc_hc_driver = {
static int whc_probe(struct umc_dev *umc)
{
- int ret = -ENOMEM;
+ int ret;
struct usb_hcd *usb_hcd;
- struct wusbhc *wusbhc = NULL;
- struct whc *whc = NULL;
+ struct wusbhc *wusbhc;
+ struct whc *whc;
struct device *dev = &umc->dev;
usb_hcd = usb_create_hcd(&whc_hc_driver, dev, "whci");
if (usb_hcd == NULL) {
dev_err(dev, "unable to create hcd\n");
- goto error;
+ return -ENOMEM;
}
usb_hcd->wireless = 1;