V4L/DVB: radio-si4713: Release i2c adapter in driver cleanup paths
authorJarkko Nikula <jhnikula@gmail.com>
Tue, 21 Sep 2010 08:49:42 +0000 (05:49 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Thu, 21 Oct 2010 03:06:20 +0000 (01:06 -0200)
Call to i2c_put_adapter was missing in radio_si4713_pdriver_probe and
radio_si4713_pdriver_remove.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Eduardo Valentin <eduardo.valentin@nokia.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/radio/radio-si4713.c

index 13554ab13f76afd8c29893aabde59a1c3d5d6a20..0a9fc4d2165c4973a1b82d311cc661fe59825c61 100644 (file)
@@ -296,14 +296,14 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev)
        if (!sd) {
                dev_err(&pdev->dev, "Cannot get v4l2 subdevice\n");
                rval = -ENODEV;
-               goto unregister_v4l2_dev;
+               goto put_adapter;
        }
 
        rsdev->radio_dev = video_device_alloc();
        if (!rsdev->radio_dev) {
                dev_err(&pdev->dev, "Failed to alloc video device.\n");
                rval = -ENOMEM;
-               goto unregister_v4l2_dev;
+               goto put_adapter;
        }
 
        memcpy(rsdev->radio_dev, &radio_si4713_vdev_template,
@@ -320,6 +320,8 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev)
 
 free_vdev:
        video_device_release(rsdev->radio_dev);
+put_adapter:
+       i2c_put_adapter(adapter);
 unregister_v4l2_dev:
        v4l2_device_unregister(&rsdev->v4l2_dev);
 free_rsdev:
@@ -335,8 +337,12 @@ static int __exit radio_si4713_pdriver_remove(struct platform_device *pdev)
        struct radio_si4713_device *rsdev = container_of(v4l2_dev,
                                                struct radio_si4713_device,
                                                v4l2_dev);
+       struct v4l2_subdev *sd = list_entry(v4l2_dev->subdevs.next,
+                                           struct v4l2_subdev, list);
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
 
        video_unregister_device(rsdev->radio_dev);
+       i2c_put_adapter(client->adapter);
        v4l2_device_unregister(&rsdev->v4l2_dev);
        kfree(rsdev);