aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/radio/radio-si4713.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/radio/radio-si4713.c b/drivers/media/radio/radio-si4713.c
index 13554ab13f76..0a9fc4d2165c 100644
--- a/drivers/media/radio/radio-si4713.c
+++ b/drivers/media/radio/radio-si4713.c
@@ -296,14 +296,14 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev)
296 if (!sd) { 296 if (!sd) {
297 dev_err(&pdev->dev, "Cannot get v4l2 subdevice\n"); 297 dev_err(&pdev->dev, "Cannot get v4l2 subdevice\n");
298 rval = -ENODEV; 298 rval = -ENODEV;
299 goto unregister_v4l2_dev; 299 goto put_adapter;
300 } 300 }
301 301
302 rsdev->radio_dev = video_device_alloc(); 302 rsdev->radio_dev = video_device_alloc();
303 if (!rsdev->radio_dev) { 303 if (!rsdev->radio_dev) {
304 dev_err(&pdev->dev, "Failed to alloc video device.\n"); 304 dev_err(&pdev->dev, "Failed to alloc video device.\n");
305 rval = -ENOMEM; 305 rval = -ENOMEM;
306 goto unregister_v4l2_dev; 306 goto put_adapter;
307 } 307 }
308 308
309 memcpy(rsdev->radio_dev, &radio_si4713_vdev_template, 309 memcpy(rsdev->radio_dev, &radio_si4713_vdev_template,
@@ -320,6 +320,8 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev)
320 320
321free_vdev: 321free_vdev:
322 video_device_release(rsdev->radio_dev); 322 video_device_release(rsdev->radio_dev);
323put_adapter:
324 i2c_put_adapter(adapter);
323unregister_v4l2_dev: 325unregister_v4l2_dev:
324 v4l2_device_unregister(&rsdev->v4l2_dev); 326 v4l2_device_unregister(&rsdev->v4l2_dev);
325free_rsdev: 327free_rsdev:
@@ -335,8 +337,12 @@ static int __exit radio_si4713_pdriver_remove(struct platform_device *pdev)
335 struct radio_si4713_device *rsdev = container_of(v4l2_dev, 337 struct radio_si4713_device *rsdev = container_of(v4l2_dev,
336 struct radio_si4713_device, 338 struct radio_si4713_device,
337 v4l2_dev); 339 v4l2_dev);
340 struct v4l2_subdev *sd = list_entry(v4l2_dev->subdevs.next,
341 struct v4l2_subdev, list);
342 struct i2c_client *client = v4l2_get_subdevdata(sd);
338 343
339 video_unregister_device(rsdev->radio_dev); 344 video_unregister_device(rsdev->radio_dev);
345 i2c_put_adapter(client->adapter);
340 v4l2_device_unregister(&rsdev->v4l2_dev); 346 v4l2_device_unregister(&rsdev->v4l2_dev);
341 kfree(rsdev); 347 kfree(rsdev);
342 348