Commit 14d4031d authored by Axel Lin's avatar Axel Lin Committed by Chris Ball

mmc: ushc: Return proper error code for ushc_probe()

Improves error handling in the ushc driver.
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarDavid Vrabel <david.vrabel@csr.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 25d5c699
...@@ -425,7 +425,7 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -425,7 +425,7 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id
struct usb_device *usb_dev = interface_to_usbdev(intf); struct usb_device *usb_dev = interface_to_usbdev(intf);
struct mmc_host *mmc; struct mmc_host *mmc;
struct ushc_data *ushc; struct ushc_data *ushc;
int ret = -ENOMEM; int ret;
mmc = mmc_alloc_host(sizeof(struct ushc_data), &intf->dev); mmc = mmc_alloc_host(sizeof(struct ushc_data), &intf->dev);
if (mmc == NULL) if (mmc == NULL)
...@@ -462,11 +462,15 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -462,11 +462,15 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id
mmc->max_blk_count = 511; mmc->max_blk_count = 511;
ushc->int_urb = usb_alloc_urb(0, GFP_KERNEL); ushc->int_urb = usb_alloc_urb(0, GFP_KERNEL);
if (ushc->int_urb == NULL) if (ushc->int_urb == NULL) {
ret = -ENOMEM;
goto err; goto err;
}
ushc->int_data = kzalloc(sizeof(struct ushc_int_data), GFP_KERNEL); ushc->int_data = kzalloc(sizeof(struct ushc_int_data), GFP_KERNEL);
if (ushc->int_data == NULL) if (ushc->int_data == NULL) {
ret = -ENOMEM;
goto err; goto err;
}
usb_fill_int_urb(ushc->int_urb, ushc->usb_dev, usb_fill_int_urb(ushc->int_urb, ushc->usb_dev,
usb_rcvintpipe(usb_dev, usb_rcvintpipe(usb_dev,
intf->cur_altsetting->endpoint[0].desc.bEndpointAddress), intf->cur_altsetting->endpoint[0].desc.bEndpointAddress),
...@@ -475,11 +479,15 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -475,11 +479,15 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id
intf->cur_altsetting->endpoint[0].desc.bInterval); intf->cur_altsetting->endpoint[0].desc.bInterval);
ushc->cbw_urb = usb_alloc_urb(0, GFP_KERNEL); ushc->cbw_urb = usb_alloc_urb(0, GFP_KERNEL);
if (ushc->cbw_urb == NULL) if (ushc->cbw_urb == NULL) {
ret = -ENOMEM;
goto err; goto err;
}
ushc->cbw = kzalloc(sizeof(struct ushc_cbw), GFP_KERNEL); ushc->cbw = kzalloc(sizeof(struct ushc_cbw), GFP_KERNEL);
if (ushc->cbw == NULL) if (ushc->cbw == NULL) {
ret = -ENOMEM;
goto err; goto err;
}
ushc->cbw->signature = USHC_CBW_SIGNATURE; ushc->cbw->signature = USHC_CBW_SIGNATURE;
usb_fill_bulk_urb(ushc->cbw_urb, ushc->usb_dev, usb_sndbulkpipe(usb_dev, 2), usb_fill_bulk_urb(ushc->cbw_urb, ushc->usb_dev, usb_sndbulkpipe(usb_dev, 2),
...@@ -487,15 +495,21 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -487,15 +495,21 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id
cbw_callback, ushc); cbw_callback, ushc);
ushc->data_urb = usb_alloc_urb(0, GFP_KERNEL); ushc->data_urb = usb_alloc_urb(0, GFP_KERNEL);
if (ushc->data_urb == NULL) if (ushc->data_urb == NULL) {
ret = -ENOMEM;
goto err; goto err;
}
ushc->csw_urb = usb_alloc_urb(0, GFP_KERNEL); ushc->csw_urb = usb_alloc_urb(0, GFP_KERNEL);
if (ushc->csw_urb == NULL) if (ushc->csw_urb == NULL) {
ret = -ENOMEM;
goto err; goto err;
}
ushc->csw = kzalloc(sizeof(struct ushc_cbw), GFP_KERNEL); ushc->csw = kzalloc(sizeof(struct ushc_cbw), GFP_KERNEL);
if (ushc->csw == NULL) if (ushc->csw == NULL) {
ret = -ENOMEM;
goto err; goto err;
}
usb_fill_bulk_urb(ushc->csw_urb, ushc->usb_dev, usb_rcvbulkpipe(usb_dev, 6), usb_fill_bulk_urb(ushc->csw_urb, ushc->usb_dev, usb_rcvbulkpipe(usb_dev, 6),
ushc->csw, sizeof(struct ushc_csw), ushc->csw, sizeof(struct ushc_csw),
csw_callback, ushc); csw_callback, ushc);
......
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