summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/adv7183.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-05-02 15:29:43 +0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-05-21 14:52:15 +0400
commitc02b211df6fc54e51ee554c27a6736a11255a764 (patch)
treea2b78b3a7a0400550fdd89da110d1b21a9e1acb1 /drivers/media/i2c/adv7183.c
parent95323361e5313733a54771c5059f5b352adbf32c (diff)
downloadlinux-c02b211df6fc54e51ee554c27a6736a11255a764.tar.xz
[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/adv7183.c')
-rw-r--r--drivers/media/i2c/adv7183.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c
index 2bc032894bae..56904174abc3 100644
--- a/drivers/media/i2c/adv7183.c
+++ b/drivers/media/i2c/adv7183.c
@@ -573,7 +573,7 @@ static int adv7183_probe(struct i2c_client *client,
if (pin_array == NULL)
return -EINVAL;
- decoder = kzalloc(sizeof(struct adv7183), GFP_KERNEL);
+ decoder = devm_kzalloc(&client->dev, sizeof(*decoder), GFP_KERNEL);
if (decoder == NULL)
return -ENOMEM;
@@ -583,8 +583,7 @@ static int adv7183_probe(struct i2c_client *client,
if (gpio_request_one(decoder->reset_pin, GPIOF_OUT_INIT_LOW,
"ADV7183 Reset")) {
v4l_err(client, "failed to request GPIO %d\n", decoder->reset_pin);
- ret = -EBUSY;
- goto err_free_decoder;
+ return -EBUSY;
}
if (gpio_request_one(decoder->oe_pin, GPIOF_OUT_INIT_HIGH,
@@ -646,8 +645,6 @@ err_free_oe:
gpio_free(decoder->oe_pin);
err_free_reset:
gpio_free(decoder->reset_pin);
-err_free_decoder:
- kfree(decoder);
return ret;
}
@@ -660,7 +657,6 @@ static int adv7183_remove(struct i2c_client *client)
v4l2_ctrl_handler_free(sd->ctrl_handler);
gpio_free(decoder->oe_pin);
gpio_free(decoder->reset_pin);
- kfree(decoder);
return 0;
}