aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/soc_camera/rj54n1cb0c.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-12-21 10:28:43 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-01-05 01:45:31 -0200
commit70e176a5a9839ea22f0fbcfa21d1c8ae952a0dd2 (patch)
tree4ab23748088e87ae0eb086a41dfdad4a222c0206 /drivers/media/i2c/soc_camera/rj54n1cb0c.c
parent[media] soc-camera: split struct soc_camera_link into host and subdevice parts (diff)
downloadlinux-dev-70e176a5a9839ea22f0fbcfa21d1c8ae952a0dd2.tar.xz
linux-dev-70e176a5a9839ea22f0fbcfa21d1c8ae952a0dd2.zip
[media] soc-camera: use devm_kzalloc in subdevice drivers
I2C drivers can use devm_kzalloc() too in their .probe() methods. Doing so simplifies their clean up paths. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/soc_camera/rj54n1cb0c.c')
-rw-r--r--drivers/media/i2c/soc_camera/rj54n1cb0c.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/media/i2c/soc_camera/rj54n1cb0c.c b/drivers/media/i2c/soc_camera/rj54n1cb0c.c
index 297e28817e45..5c92679bfefb 100644
--- a/drivers/media/i2c/soc_camera/rj54n1cb0c.c
+++ b/drivers/media/i2c/soc_camera/rj54n1cb0c.c
@@ -1352,7 +1352,7 @@ static int rj54n1_probe(struct i2c_client *client,
return -EIO;
}
- rj54n1 = kzalloc(sizeof(struct rj54n1), GFP_KERNEL);
+ rj54n1 = devm_kzalloc(&client->dev, sizeof(struct rj54n1), GFP_KERNEL);
if (!rj54n1)
return -ENOMEM;
@@ -1367,12 +1367,8 @@ static int rj54n1_probe(struct i2c_client *client,
v4l2_ctrl_new_std(&rj54n1->hdl, &rj54n1_ctrl_ops,
V4L2_CID_AUTO_WHITE_BALANCE, 0, 1, 1, 1);
rj54n1->subdev.ctrl_handler = &rj54n1->hdl;
- if (rj54n1->hdl.error) {
- int err = rj54n1->hdl.error;
-
- kfree(rj54n1);
- return err;
- }
+ if (rj54n1->hdl.error)
+ return rj54n1->hdl.error;
rj54n1->clk_div = clk_div;
rj54n1->rect.left = RJ54N1_COLUMN_SKIP;
@@ -1387,10 +1383,8 @@ static int rj54n1_probe(struct i2c_client *client,
(clk_div.ratio_tg + 1) / (clk_div.ratio_t + 1);
ret = rj54n1_video_probe(client, rj54n1_priv);
- if (ret < 0) {
+ if (ret < 0)
v4l2_ctrl_handler_free(&rj54n1->hdl);
- kfree(rj54n1);
- }
return ret;
}
@@ -1404,7 +1398,6 @@ static int rj54n1_remove(struct i2c_client *client)
if (ssdd->free_bus)
ssdd->free_bus(ssdd);
v4l2_ctrl_handler_free(&rj54n1->hdl);
- kfree(rj54n1);
return 0;
}