aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/radio-isa.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-04-28 07:09:48 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-07 14:23:31 -0400
commitf61861fa567928614c6dd01560b320bfeb24e3e2 (patch)
tree7c2453a4d487cdb61292b4f65f9fc21003374e88 /drivers/media/radio/radio-isa.c
parentff27cda340450b4d5267a79109204e853f95cb4c (diff)
[media] radio-isa: fix memory leak
If there is an error when creating controls the v4l2_ctrl_handler_free function must be called. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio/radio-isa.c')
-rw-r--r--drivers/media/radio/radio-isa.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/media/radio/radio-isa.c b/drivers/media/radio/radio-isa.c
index ed9039f8571c..c7450fb90d2b 100644
--- a/drivers/media/radio/radio-isa.c
+++ b/drivers/media/radio/radio-isa.c
@@ -274,23 +274,21 @@ int radio_isa_common_probe(struct radio_isa_card *isa, struct device *pdev,
274 res = ops->s_stereo(isa, isa->stereo); 274 res = ops->s_stereo(isa, isa->stereo);
275 if (res < 0) { 275 if (res < 0) {
276 v4l2_err(v4l2_dev, "Could not setup card\n"); 276 v4l2_err(v4l2_dev, "Could not setup card\n");
277 goto err_node_reg; 277 goto err_hdl;
278 } 278 }
279 res = video_register_device(&isa->vdev, VFL_TYPE_RADIO, radio_nr); 279 res = video_register_device(&isa->vdev, VFL_TYPE_RADIO, radio_nr);
280 280
281 if (res < 0) { 281 if (res < 0) {
282 v4l2_err(v4l2_dev, "Could not register device node\n"); 282 v4l2_err(v4l2_dev, "Could not register device node\n");
283 goto err_node_reg; 283 goto err_hdl;
284 } 284 }
285 285
286 v4l2_info(v4l2_dev, "Initialized radio card %s on port 0x%03x\n", 286 v4l2_info(v4l2_dev, "Initialized radio card %s on port 0x%03x\n",
287 drv->card, isa->io); 287 drv->card, isa->io);
288 return 0; 288 return 0;
289 289
290err_node_reg:
291 v4l2_ctrl_handler_free(&isa->hdl);
292err_hdl: 290err_hdl:
293 v4l2_device_unregister(&isa->v4l2_dev); 291 v4l2_ctrl_handler_free(&isa->hdl);
294err_dev_reg: 292err_dev_reg:
295 release_region(isa->io, region_size); 293 release_region(isa->io, region_size);
296 kfree(isa); 294 kfree(isa);