diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-12-21 16:34:06 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-14 15:59:35 -0300 |
commit | 37b9f2117f3b4b554315b0e7b357bfabb58a0204 (patch) | |
tree | 3762a9d5adacd5ba148e65204a0a8a7381da8645 /drivers/media/i2c | |
parent | 73254c30db7116c4bae1adffab0dd2ac68486933 (diff) | |
download | op-kernel-dev-37b9f2117f3b4b554315b0e7b357bfabb58a0204.zip op-kernel-dev-37b9f2117f3b4b554315b0e7b357bfabb58a0204.tar.gz |
[media] mt9p031: Use devm_* managed helpers
Replace kzalloc and gpio_request_one by their managed equivalents.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/mt9p031.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index e328332..e0bad59 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -927,7 +927,7 @@ static int mt9p031_probe(struct i2c_client *client, return -EIO; } - mt9p031 = kzalloc(sizeof(*mt9p031), GFP_KERNEL); + mt9p031 = devm_kzalloc(&client->dev, sizeof(*mt9p031), GFP_KERNEL); if (mt9p031 == NULL) return -ENOMEM; @@ -1001,8 +1001,8 @@ static int mt9p031_probe(struct i2c_client *client, mt9p031->format.colorspace = V4L2_COLORSPACE_SRGB; if (pdata->reset != -1) { - ret = gpio_request_one(pdata->reset, GPIOF_OUT_INIT_LOW, - "mt9p031_rst"); + ret = devm_gpio_request_one(&client->dev, pdata->reset, + GPIOF_OUT_INIT_LOW, "mt9p031_rst"); if (ret < 0) goto done; @@ -1013,12 +1013,8 @@ static int mt9p031_probe(struct i2c_client *client, done: if (ret < 0) { - if (mt9p031->reset != -1) - gpio_free(mt9p031->reset); - v4l2_ctrl_handler_free(&mt9p031->ctrls); media_entity_cleanup(&mt9p031->subdev.entity); - kfree(mt9p031); } return ret; @@ -1032,9 +1028,6 @@ static int mt9p031_remove(struct i2c_client *client) v4l2_ctrl_handler_free(&mt9p031->ctrls); v4l2_device_unregister_subdev(subdev); media_entity_cleanup(&subdev->entity); - if (mt9p031->reset != -1) - gpio_free(mt9p031->reset); - kfree(mt9p031); return 0; } |