Skip to content

Commit

Permalink
V4L/DVB (11393): radio-si470x: fix possible bug with freeing memory o…
Browse files Browse the repository at this point in the history
…rder

Patch fixes cleanup procedure in si470x_usb_driver_probe. Add new label
err_video and change order of freeing memory.

Signed-off-by: Alexey Klimov <klimov.linux@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Alexey Klimov authored and Mauro Carvalho Chehab committed Apr 7, 2009
1 parent b7732a3 commit 81d1d09
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/media/radio/radio-si470x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1686,15 +1686,15 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
/* show some infos about the specific si470x device */
if (si470x_get_all_registers(radio) < 0) {
retval = -EIO;
goto err_all;
goto err_video;
}
printk(KERN_INFO DRIVER_NAME ": DeviceID=0x%4.4hx ChipID=0x%4.4hx\n",
radio->registers[DEVICEID], radio->registers[CHIPID]);

/* get software and hardware versions */
if (si470x_get_scratch_page_versions(radio) < 0) {
retval = -EIO;
goto err_all;
goto err_video;
}
printk(KERN_INFO DRIVER_NAME
": software version %d, hardware version %d\n",
Expand Down Expand Up @@ -1727,7 +1727,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL);
if (!radio->buffer) {
retval = -EIO;
goto err_all;
goto err_video;
}

/* rds buffer configuration */
Expand All @@ -1749,8 +1749,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,

return 0;
err_all:
video_device_release(radio->videodev);
kfree(radio->buffer);
err_video:
video_device_release(radio->videodev);
err_radio:
kfree(radio);
err_initial:
Expand Down

0 comments on commit 81d1d09

Please sign in to comment.