aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/ad9389b.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-05-02 07:29:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-05-21 06:52:15 -0400
commitc02b211df6fc54e51ee554c27a6736a11255a764 (patch)
treea2b78b3a7a0400550fdd89da110d1b21a9e1acb1 /drivers/media/i2c/ad9389b.c
parent95323361e5313733a54771c5059f5b352adbf32c (diff)
[media] media: i2c: Convert to devm_kzalloc()
Using the managed function the kfree() calls can be removed from the probe error path and the remove handler. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c/ad9389b.c')
-rw-r--r--drivers/media/i2c/ad9389b.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index 58344b6c3a55..15043554cc8b 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -1188,15 +1188,14 @@ static int ad9389b_probe(struct i2c_client *client, const struct i2c_device_id *
1188 v4l_dbg(1, debug, client, "detecting ad9389b client on address 0x%x\n", 1188 v4l_dbg(1, debug, client, "detecting ad9389b client on address 0x%x\n",
1189 client->addr << 1); 1189 client->addr << 1);
1190 1190
1191 state = kzalloc(sizeof(struct ad9389b_state), GFP_KERNEL); 1191 state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);
1192 if (!state) 1192 if (!state)
1193 return -ENOMEM; 1193 return -ENOMEM;
1194 1194
1195 /* Platform data */ 1195 /* Platform data */
1196 if (pdata == NULL) { 1196 if (pdata == NULL) {
1197 v4l_err(client, "No platform data!\n"); 1197 v4l_err(client, "No platform data!\n");
1198 err = -ENODEV; 1198 return -ENODEV;
1199 goto err_free;
1200 } 1199 }
1201 memcpy(&state->pdata, pdata, sizeof(state->pdata)); 1200 memcpy(&state->pdata, pdata, sizeof(state->pdata));
1202 1201
@@ -1276,8 +1275,6 @@ err_entity:
1276 media_entity_cleanup(&sd->entity); 1275 media_entity_cleanup(&sd->entity);
1277err_hdl: 1276err_hdl:
1278 v4l2_ctrl_handler_free(&state->hdl); 1277 v4l2_ctrl_handler_free(&state->hdl);
1279err_free:
1280 kfree(state);
1281 return err; 1278 return err;
1282} 1279}
1283 1280
@@ -1302,7 +1299,6 @@ static int ad9389b_remove(struct i2c_client *client)
1302 v4l2_device_unregister_subdev(sd); 1299 v4l2_device_unregister_subdev(sd);
1303 media_entity_cleanup(&sd->entity); 1300 media_entity_cleanup(&sd->entity);
1304 v4l2_ctrl_handler_free(sd->ctrl_handler); 1301 v4l2_ctrl_handler_free(sd->ctrl_handler);
1305 kfree(get_ad9389b_state(sd));
1306 return 0; 1302 return 0;
1307} 1303}
1308 1304