提交 c44048de 编写于 作者: C Chris Ball

mmc: vub300: fix null dereferences in error handling

Reported-by: NDan Carpenter <error27@gmail.com>
Signed-off-by: NChris Ball <cjb@laptop.org>
上级 c11760c6
...@@ -2096,7 +2096,7 @@ static struct mmc_host_ops vub300_mmc_ops = { ...@@ -2096,7 +2096,7 @@ static struct mmc_host_ops vub300_mmc_ops = {
static int vub300_probe(struct usb_interface *interface, static int vub300_probe(struct usb_interface *interface,
const struct usb_device_id *id) const struct usb_device_id *id)
{ /* NOT irq */ { /* NOT irq */
struct vub300_mmc_host *vub300 = NULL; struct vub300_mmc_host *vub300;
struct usb_host_interface *iface_desc; struct usb_host_interface *iface_desc;
struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface)); struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface));
int i; int i;
...@@ -2118,23 +2118,20 @@ static int vub300_probe(struct usb_interface *interface, ...@@ -2118,23 +2118,20 @@ static int vub300_probe(struct usb_interface *interface,
command_out_urb = usb_alloc_urb(0, GFP_KERNEL); command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!command_out_urb) { if (!command_out_urb) {
retval = -ENOMEM; retval = -ENOMEM;
dev_err(&vub300->udev->dev, dev_err(&udev->dev, "not enough memory for command_out_urb\n");
"not enough memory for the command_out_urb\n");
goto error0; goto error0;
} }
command_res_urb = usb_alloc_urb(0, GFP_KERNEL); command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!command_res_urb) { if (!command_res_urb) {
retval = -ENOMEM; retval = -ENOMEM;
dev_err(&vub300->udev->dev, dev_err(&udev->dev, "not enough memory for command_res_urb\n");
"not enough memory for the command_res_urb\n");
goto error1; goto error1;
} }
/* this also allocates memory for our VUB300 mmc host device */ /* this also allocates memory for our VUB300 mmc host device */
mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), &udev->dev); mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), &udev->dev);
if (!mmc) { if (!mmc) {
retval = -ENOMEM; retval = -ENOMEM;
dev_err(&vub300->udev->dev, dev_err(&udev->dev, "not enough memory for the mmc_host\n");
"not enough memory for the mmc_host\n");
goto error4; goto error4;
} }
/* MMC core transfer sizes tunable parameters */ /* MMC core transfer sizes tunable parameters */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册