diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-12-21 14:34:06 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-14 14:59:35 -0400 |
commit | 37b9f2117f3b4b554315b0e7b357bfabb58a0204 (patch) | |
tree | 3762a9d5adacd5ba148e65204a0a8a7381da8645 /drivers/media/i2c/mt9p031.c | |
parent | 73254c30db7116c4bae1adffab0dd2ac68486933 (diff) |
[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/mt9p031.c')
-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 e32833262d32..e0bad594c8da 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, | |||
927 | return -EIO; | 927 | return -EIO; |
928 | } | 928 | } |
929 | 929 | ||
930 | mt9p031 = kzalloc(sizeof(*mt9p031), GFP_KERNEL); | 930 | mt9p031 = devm_kzalloc(&client->dev, sizeof(*mt9p031), GFP_KERNEL); |
931 | if (mt9p031 == NULL) | 931 | if (mt9p031 == NULL) |
932 | return -ENOMEM; | 932 | return -ENOMEM; |
933 | 933 | ||
@@ -1001,8 +1001,8 @@ static int mt9p031_probe(struct i2c_client *client, | |||
1001 | mt9p031->format.colorspace = V4L2_COLORSPACE_SRGB; | 1001 | mt9p031->format.colorspace = V4L2_COLORSPACE_SRGB; |
1002 | 1002 | ||
1003 | if (pdata->reset != -1) { | 1003 | if (pdata->reset != -1) { |
1004 | ret = gpio_request_one(pdata->reset, GPIOF_OUT_INIT_LOW, | 1004 | ret = devm_gpio_request_one(&client->dev, pdata->reset, |
1005 | "mt9p031_rst"); | 1005 | GPIOF_OUT_INIT_LOW, "mt9p031_rst"); |
1006 | if (ret < 0) | 1006 | if (ret < 0) |
1007 | goto done; | 1007 | goto done; |
1008 | 1008 | ||
@@ -1013,12 +1013,8 @@ static int mt9p031_probe(struct i2c_client *client, | |||
1013 | 1013 | ||
1014 | done: | 1014 | done: |
1015 | if (ret < 0) { | 1015 | if (ret < 0) { |
1016 | if (mt9p031->reset != -1) | ||
1017 | gpio_free(mt9p031->reset); | ||
1018 | |||
1019 | v4l2_ctrl_handler_free(&mt9p031->ctrls); | 1016 | v4l2_ctrl_handler_free(&mt9p031->ctrls); |
1020 | media_entity_cleanup(&mt9p031->subdev.entity); | 1017 | media_entity_cleanup(&mt9p031->subdev.entity); |
1021 | kfree(mt9p031); | ||
1022 | } | 1018 | } |
1023 | 1019 | ||
1024 | return ret; | 1020 | return ret; |
@@ -1032,9 +1028,6 @@ static int mt9p031_remove(struct i2c_client *client) | |||
1032 | v4l2_ctrl_handler_free(&mt9p031->ctrls); | 1028 | v4l2_ctrl_handler_free(&mt9p031->ctrls); |
1033 | v4l2_device_unregister_subdev(subdev); | 1029 | v4l2_device_unregister_subdev(subdev); |
1034 | media_entity_cleanup(&subdev->entity); | 1030 | media_entity_cleanup(&subdev->entity); |
1035 | if (mt9p031->reset != -1) | ||
1036 | gpio_free(mt9p031->reset); | ||
1037 | kfree(mt9p031); | ||
1038 | 1031 | ||
1039 | return 0; | 1032 | return 0; |
1040 | } | 1033 | } |