Commit 81d1d09f authored by Alexey Klimov's avatar Alexey Klimov Committed by Mauro Carvalho Chehab

V4L/DVB (11393): radio-si470x: fix possible bug with freeing memory order

Patch fixes cleanup procedure in si470x_usb_driver_probe. Add new label
err_video and change order of freeing memory.
Signed-off-by: default avatarAlexey Klimov <klimov.linux@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b7732a32
...@@ -1686,7 +1686,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, ...@@ -1686,7 +1686,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
/* show some infos about the specific si470x device */ /* show some infos about the specific si470x device */
if (si470x_get_all_registers(radio) < 0) { if (si470x_get_all_registers(radio) < 0) {
retval = -EIO; retval = -EIO;
goto err_all; goto err_video;
} }
printk(KERN_INFO DRIVER_NAME ": DeviceID=0x%4.4hx ChipID=0x%4.4hx\n", printk(KERN_INFO DRIVER_NAME ": DeviceID=0x%4.4hx ChipID=0x%4.4hx\n",
radio->registers[DEVICEID], radio->registers[CHIPID]); radio->registers[DEVICEID], radio->registers[CHIPID]);
...@@ -1694,7 +1694,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, ...@@ -1694,7 +1694,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
/* get software and hardware versions */ /* get software and hardware versions */
if (si470x_get_scratch_page_versions(radio) < 0) { if (si470x_get_scratch_page_versions(radio) < 0) {
retval = -EIO; retval = -EIO;
goto err_all; goto err_video;
} }
printk(KERN_INFO DRIVER_NAME printk(KERN_INFO DRIVER_NAME
": software version %d, hardware version %d\n", ": software version %d, hardware version %d\n",
...@@ -1727,7 +1727,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, ...@@ -1727,7 +1727,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL); radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL);
if (!radio->buffer) { if (!radio->buffer) {
retval = -EIO; retval = -EIO;
goto err_all; goto err_video;
} }
/* rds buffer configuration */ /* rds buffer configuration */
...@@ -1749,8 +1749,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, ...@@ -1749,8 +1749,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
return 0; return 0;
err_all: err_all:
video_device_release(radio->videodev);
kfree(radio->buffer); kfree(radio->buffer);
err_video:
video_device_release(radio->videodev);
err_radio: err_radio:
kfree(radio); kfree(radio);
err_initial: err_initial:
......
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