diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2013-05-02 07:29:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-05-21 06:52:15 -0400 |
commit | c02b211df6fc54e51ee554c27a6736a11255a764 (patch) | |
tree | a2b78b3a7a0400550fdd89da110d1b21a9e1acb1 /drivers/media/i2c/saa7115.c | |
parent | 95323361e5313733a54771c5059f5b352adbf32c (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/saa7115.c')
-rw-r--r-- | drivers/media/i2c/saa7115.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c index 52c717d977c9..eecb92df5d96 100644 --- a/drivers/media/i2c/saa7115.c +++ b/drivers/media/i2c/saa7115.c | |||
@@ -1614,7 +1614,7 @@ static int saa711x_probe(struct i2c_client *client, | |||
1614 | v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name, | 1614 | v4l_info(client, "saa711%c found (%s) @ 0x%x (%s)\n", chip_id, name, |
1615 | client->addr << 1, client->adapter->name); | 1615 | client->addr << 1, client->adapter->name); |
1616 | 1616 | ||
1617 | state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); | 1617 | state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL); |
1618 | if (state == NULL) | 1618 | if (state == NULL) |
1619 | return -ENOMEM; | 1619 | return -ENOMEM; |
1620 | sd = &state->sd; | 1620 | sd = &state->sd; |
@@ -1640,7 +1640,6 @@ static int saa711x_probe(struct i2c_client *client, | |||
1640 | int err = hdl->error; | 1640 | int err = hdl->error; |
1641 | 1641 | ||
1642 | v4l2_ctrl_handler_free(hdl); | 1642 | v4l2_ctrl_handler_free(hdl); |
1643 | kfree(state); | ||
1644 | return err; | 1643 | return err; |
1645 | } | 1644 | } |
1646 | v4l2_ctrl_auto_cluster(2, &state->agc, 0, true); | 1645 | v4l2_ctrl_auto_cluster(2, &state->agc, 0, true); |
@@ -1712,7 +1711,6 @@ static int saa711x_remove(struct i2c_client *client) | |||
1712 | 1711 | ||
1713 | v4l2_device_unregister_subdev(sd); | 1712 | v4l2_device_unregister_subdev(sd); |
1714 | v4l2_ctrl_handler_free(sd->ctrl_handler); | 1713 | v4l2_ctrl_handler_free(sd->ctrl_handler); |
1715 | kfree(to_state(sd)); | ||
1716 | return 0; | 1714 | return 0; |
1717 | } | 1715 | } |
1718 | 1716 | ||