diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-07-31 04:21:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-13 15:29:58 -0400 |
commit | 28e9cc8056bddce5863e455028369cd3b01ef941 (patch) | |
tree | bf21d38188f113c245cc2e018f3dfeae677bbd39 /drivers/media/radio | |
parent | d91e0139351b040ec558accab84bf59d5cef5552 (diff) |
[media] drivers/media/radio/radio-si4713.c: use devm_ functions
The various devm_ functions allocate memory that is released when a driver
detaches. This patch uses these functions for data that is allocated in
the probe function of a platform device and is only freed in the remove
function.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r-- | drivers/media/radio/radio-si4713.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/media/radio/radio-si4713.c b/drivers/media/radio/radio-si4713.c index c54210c7fef9..5f366d16be26 100644 --- a/drivers/media/radio/radio-si4713.c +++ b/drivers/media/radio/radio-si4713.c | |||
@@ -268,7 +268,7 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev) | |||
268 | goto exit; | 268 | goto exit; |
269 | } | 269 | } |
270 | 270 | ||
271 | rsdev = kzalloc(sizeof *rsdev, GFP_KERNEL); | 271 | rsdev = devm_kzalloc(&pdev->dev, sizeof(*rsdev), GFP_KERNEL); |
272 | if (!rsdev) { | 272 | if (!rsdev) { |
273 | dev_err(&pdev->dev, "Failed to alloc video device.\n"); | 273 | dev_err(&pdev->dev, "Failed to alloc video device.\n"); |
274 | rval = -ENOMEM; | 274 | rval = -ENOMEM; |
@@ -278,7 +278,7 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev) | |||
278 | rval = v4l2_device_register(&pdev->dev, &rsdev->v4l2_dev); | 278 | rval = v4l2_device_register(&pdev->dev, &rsdev->v4l2_dev); |
279 | if (rval) { | 279 | if (rval) { |
280 | dev_err(&pdev->dev, "Failed to register v4l2 device.\n"); | 280 | dev_err(&pdev->dev, "Failed to register v4l2 device.\n"); |
281 | goto free_rsdev; | 281 | goto exit; |
282 | } | 282 | } |
283 | 283 | ||
284 | adapter = i2c_get_adapter(pdata->i2c_bus); | 284 | adapter = i2c_get_adapter(pdata->i2c_bus); |
@@ -322,8 +322,6 @@ put_adapter: | |||
322 | i2c_put_adapter(adapter); | 322 | i2c_put_adapter(adapter); |
323 | unregister_v4l2_dev: | 323 | unregister_v4l2_dev: |
324 | v4l2_device_unregister(&rsdev->v4l2_dev); | 324 | v4l2_device_unregister(&rsdev->v4l2_dev); |
325 | free_rsdev: | ||
326 | kfree(rsdev); | ||
327 | exit: | 325 | exit: |
328 | return rval; | 326 | return rval; |
329 | } | 327 | } |
@@ -342,7 +340,6 @@ static int __exit radio_si4713_pdriver_remove(struct platform_device *pdev) | |||
342 | video_unregister_device(rsdev->radio_dev); | 340 | video_unregister_device(rsdev->radio_dev); |
343 | i2c_put_adapter(client->adapter); | 341 | i2c_put_adapter(client->adapter); |
344 | v4l2_device_unregister(&rsdev->v4l2_dev); | 342 | v4l2_device_unregister(&rsdev->v4l2_dev); |
345 | kfree(rsdev); | ||
346 | 343 | ||
347 | return 0; | 344 | return 0; |
348 | } | 345 | } |