aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/ad9389b.c
diff options
context:
space:
mode:
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