diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2012-12-21 10:28:43 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-01-05 01:45:31 -0200 |
commit | 70e176a5a9839ea22f0fbcfa21d1c8ae952a0dd2 (patch) | |
tree | 4ab23748088e87ae0eb086a41dfdad4a222c0206 /drivers/media/i2c/soc_camera/ov5642.c | |
parent | 25a348110078cefa99b0b079938dd930cfc3a0be (diff) | |
download | op-kernel-dev-70e176a5a9839ea22f0fbcfa21d1c8ae952a0dd2.zip op-kernel-dev-70e176a5a9839ea22f0fbcfa21d1c8ae952a0dd2.tar.gz |
[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/ov5642.c')
-rw-r--r-- | drivers/media/i2c/soc_camera/ov5642.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/media/i2c/soc_camera/ov5642.c b/drivers/media/i2c/soc_camera/ov5642.c index b892d01..9d53309 100644 --- a/drivers/media/i2c/soc_camera/ov5642.c +++ b/drivers/media/i2c/soc_camera/ov5642.c @@ -1021,14 +1021,13 @@ static int ov5642_probe(struct i2c_client *client, { struct ov5642 *priv; struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); - int ret; if (!ssdd) { dev_err(&client->dev, "OV5642: missing platform data!\n"); return -EINVAL; } - priv = kzalloc(sizeof(struct ov5642), GFP_KERNEL); + priv = devm_kzalloc(&client->dev, sizeof(struct ov5642), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -1043,25 +1042,15 @@ static int ov5642_probe(struct i2c_client *client, priv->total_width = OV5642_DEFAULT_WIDTH + BLANKING_EXTRA_WIDTH; priv->total_height = BLANKING_MIN_HEIGHT; - ret = ov5642_video_probe(client); - if (ret < 0) - goto error; - - return 0; - -error: - kfree(priv); - return ret; + return ov5642_video_probe(client); } static int ov5642_remove(struct i2c_client *client) { - struct ov5642 *priv = to_ov5642(client); struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); if (ssdd->free_bus) ssdd->free_bus(ssdd); - kfree(priv); return 0; } |