diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-07-31 04:21:37 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-13 15:28:57 -0400 |
commit | 2f20c490aa3d8725305cb6333520b1c6a39858e0 (patch) | |
tree | e5927844ccd53c54675602c01237a214374c87f2 /drivers/media/radio/radio-timb.c | |
parent | 95aeead28a2597cfddf4bb11bcade1b518adf83c (diff) |
[media] drivers/media/radio/radio-timb.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/radio-timb.c')
-rw-r--r-- | drivers/media/radio/radio-timb.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/media/radio/radio-timb.c b/drivers/media/radio/radio-timb.c index 7052adc0c0b0..09fc56052d35 100644 --- a/drivers/media/radio/radio-timb.c +++ b/drivers/media/radio/radio-timb.c | |||
@@ -157,7 +157,7 @@ static int __devinit timbradio_probe(struct platform_device *pdev) | |||
157 | goto err; | 157 | goto err; |
158 | } | 158 | } |
159 | 159 | ||
160 | tr = kzalloc(sizeof(*tr), GFP_KERNEL); | 160 | tr = devm_kzalloc(&pdev->dev, sizeof(*tr), GFP_KERNEL); |
161 | if (!tr) { | 161 | if (!tr) { |
162 | err = -ENOMEM; | 162 | err = -ENOMEM; |
163 | goto err; | 163 | goto err; |
@@ -177,7 +177,7 @@ static int __devinit timbradio_probe(struct platform_device *pdev) | |||
177 | strlcpy(tr->v4l2_dev.name, DRIVER_NAME, sizeof(tr->v4l2_dev.name)); | 177 | strlcpy(tr->v4l2_dev.name, DRIVER_NAME, sizeof(tr->v4l2_dev.name)); |
178 | err = v4l2_device_register(NULL, &tr->v4l2_dev); | 178 | err = v4l2_device_register(NULL, &tr->v4l2_dev); |
179 | if (err) | 179 | if (err) |
180 | goto err_v4l2_dev; | 180 | goto err; |
181 | 181 | ||
182 | tr->video_dev.v4l2_dev = &tr->v4l2_dev; | 182 | tr->video_dev.v4l2_dev = &tr->v4l2_dev; |
183 | 183 | ||
@@ -195,8 +195,6 @@ static int __devinit timbradio_probe(struct platform_device *pdev) | |||
195 | err_video_req: | 195 | err_video_req: |
196 | video_device_release_empty(&tr->video_dev); | 196 | video_device_release_empty(&tr->video_dev); |
197 | v4l2_device_unregister(&tr->v4l2_dev); | 197 | v4l2_device_unregister(&tr->v4l2_dev); |
198 | err_v4l2_dev: | ||
199 | kfree(tr); | ||
200 | err: | 198 | err: |
201 | dev_err(&pdev->dev, "Failed to register: %d\n", err); | 199 | dev_err(&pdev->dev, "Failed to register: %d\n", err); |
202 | 200 | ||
@@ -212,8 +210,6 @@ static int __devexit timbradio_remove(struct platform_device *pdev) | |||
212 | 210 | ||
213 | v4l2_device_unregister(&tr->v4l2_dev); | 211 | v4l2_device_unregister(&tr->v4l2_dev); |
214 | 212 | ||
215 | kfree(tr); | ||
216 | |||
217 | return 0; | 213 | return 0; |
218 | } | 214 | } |
219 | 215 | ||