From c02b211df6fc54e51ee554c27a6736a11255a764 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 2 May 2013 08:29:43 -0300 Subject: [media] media: i2c: Convert to devm_kzalloc() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using the managed function the kfree() calls can be removed from the probe error path and the remove handler. Signed-off-by: Laurent Pinchart Acked-by: Sylwester Nawrocki Acked-by: Lad, Prabhakar Acked-by: Andy Shevchenko Reviewed-by: Benoît Thébaudeau Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/adv7183.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/media/i2c/adv7183.c') 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; } -- cgit v1.2.3