summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/adv7183.c
diff options
context:
space:
mode:
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;
}