]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/kernel/omap/3isp/0004-mt9p031-Use-devm_-managed-helpers.patch
ethtool: Update to 3.16
[ipfire-2.x.git] / src / patches / kernel / omap / 3isp / 0004-mt9p031-Use-devm_-managed-helpers.patch
1 From d3f188f38eaa34acf6375d5d88fe27971aae1170 Mon Sep 17 00:00:00 2001
2 From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 Date: Fri, 21 Dec 2012 20:34:06 +0100
4 Subject: [PATCH 4/6] mt9p031: Use devm_* managed helpers
5
6 Replace kzalloc and gpio_request_one by their managed equivalents.
7
8 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 ---
10 drivers/media/i2c/mt9p031.c | 13 +++----------
11 1 file changed, 3 insertions(+), 10 deletions(-)
12
13 diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
14 index e328332..e0bad59 100644
15 --- a/drivers/media/i2c/mt9p031.c
16 +++ b/drivers/media/i2c/mt9p031.c
17 @@ -927,7 +927,7 @@ static int mt9p031_probe(struct i2c_client *client,
18 return -EIO;
19 }
20
21 - mt9p031 = kzalloc(sizeof(*mt9p031), GFP_KERNEL);
22 + mt9p031 = devm_kzalloc(&client->dev, sizeof(*mt9p031), GFP_KERNEL);
23 if (mt9p031 == NULL)
24 return -ENOMEM;
25
26 @@ -1001,8 +1001,8 @@ static int mt9p031_probe(struct i2c_client *client,
27 mt9p031->format.colorspace = V4L2_COLORSPACE_SRGB;
28
29 if (pdata->reset != -1) {
30 - ret = gpio_request_one(pdata->reset, GPIOF_OUT_INIT_LOW,
31 - "mt9p031_rst");
32 + ret = devm_gpio_request_one(&client->dev, pdata->reset,
33 + GPIOF_OUT_INIT_LOW, "mt9p031_rst");
34 if (ret < 0)
35 goto done;
36
37 @@ -1013,12 +1013,8 @@ static int mt9p031_probe(struct i2c_client *client,
38
39 done:
40 if (ret < 0) {
41 - if (mt9p031->reset != -1)
42 - gpio_free(mt9p031->reset);
43 -
44 v4l2_ctrl_handler_free(&mt9p031->ctrls);
45 media_entity_cleanup(&mt9p031->subdev.entity);
46 - kfree(mt9p031);
47 }
48
49 return ret;
50 @@ -1032,9 +1028,6 @@ static int mt9p031_remove(struct i2c_client *client)
51 v4l2_ctrl_handler_free(&mt9p031->ctrls);
52 v4l2_device_unregister_subdev(subdev);
53 media_entity_cleanup(&subdev->entity);
54 - if (mt9p031->reset != -1)
55 - gpio_free(mt9p031->reset);
56 - kfree(mt9p031);
57
58 return 0;
59 }
60 --
61 1.7.10.4
62