Commit c44048dea28b3febd38417f36f7b2924d93f9bb2

Authored by Chris Ball
1 parent c11760c6d8

mmc: vub300: fix null dereferences in error handling

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>

Showing 1 changed file with 4 additions and 7 deletions Side-by-side Diff

drivers/mmc/host/vub300.c
... ... @@ -2096,7 +2096,7 @@
2096 2096 static int vub300_probe(struct usb_interface *interface,
2097 2097 const struct usb_device_id *id)
2098 2098 { /* NOT irq */
2099   - struct vub300_mmc_host *vub300 = NULL;
  2099 + struct vub300_mmc_host *vub300;
2100 2100 struct usb_host_interface *iface_desc;
2101 2101 struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface));
2102 2102 int i;
2103 2103  
2104 2104  
... ... @@ -2118,23 +2118,20 @@
2118 2118 command_out_urb = usb_alloc_urb(0, GFP_KERNEL);
2119 2119 if (!command_out_urb) {
2120 2120 retval = -ENOMEM;
2121   - dev_err(&vub300->udev->dev,
2122   - "not enough memory for the command_out_urb\n");
  2121 + dev_err(&udev->dev, "not enough memory for command_out_urb\n");
2123 2122 goto error0;
2124 2123 }
2125 2124 command_res_urb = usb_alloc_urb(0, GFP_KERNEL);
2126 2125 if (!command_res_urb) {
2127 2126 retval = -ENOMEM;
2128   - dev_err(&vub300->udev->dev,
2129   - "not enough memory for the command_res_urb\n");
  2127 + dev_err(&udev->dev, "not enough memory for command_res_urb\n");
2130 2128 goto error1;
2131 2129 }
2132 2130 /* this also allocates memory for our VUB300 mmc host device */
2133 2131 mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), &udev->dev);
2134 2132 if (!mmc) {
2135 2133 retval = -ENOMEM;
2136   - dev_err(&vub300->udev->dev,
2137   - "not enough memory for the mmc_host\n");
  2134 + dev_err(&udev->dev, "not enough memory for the mmc_host\n");
2138 2135 goto error4;
2139 2136 }
2140 2137 /* MMC core transfer sizes tunable parameters */