diff options
author | Jingoo Han <jg1.han@samsung.com> | 2012-07-30 17:40:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-30 20:25:15 -0400 |
commit | f1b60d46b6f1274f1eacfc89ddbf7f6b63348196 (patch) | |
tree | 4e9881852ce067ebf6488039a957a278c21b4247 /drivers/video | |
parent | a4be29ac6df4f7c7a0225f7f72c78f4fb10114c0 (diff) |
drivers/video/backlight/ot200_bl.c: use devm_ functions
The devm_ functions allocate memory that is released when a driver
detaches. This patch uses devm_kzalloc of these functions
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/backlight/ot200_bl.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/video/backlight/ot200_bl.c b/drivers/video/backlight/ot200_bl.c index f519d55a294c..ef637ffc0799 100644 --- a/drivers/video/backlight/ot200_bl.c +++ b/drivers/video/backlight/ot200_bl.c | |||
@@ -97,10 +97,10 @@ static int ot200_backlight_probe(struct platform_device *pdev) | |||
97 | goto error_mfgpt_alloc; | 97 | goto error_mfgpt_alloc; |
98 | } | 98 | } |
99 | 99 | ||
100 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 100 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
101 | if (!data) { | 101 | if (!data) { |
102 | retval = -ENOMEM; | 102 | retval = -ENOMEM; |
103 | goto error_kzalloc; | 103 | goto error_devm_kzalloc; |
104 | } | 104 | } |
105 | 105 | ||
106 | /* setup gpio */ | 106 | /* setup gpio */ |
@@ -122,16 +122,14 @@ static int ot200_backlight_probe(struct platform_device *pdev) | |||
122 | if (IS_ERR(bl)) { | 122 | if (IS_ERR(bl)) { |
123 | dev_err(&pdev->dev, "failed to register backlight\n"); | 123 | dev_err(&pdev->dev, "failed to register backlight\n"); |
124 | retval = PTR_ERR(bl); | 124 | retval = PTR_ERR(bl); |
125 | goto error_backlight_device_register; | 125 | goto error_devm_kzalloc; |
126 | } | 126 | } |
127 | 127 | ||
128 | platform_set_drvdata(pdev, bl); | 128 | platform_set_drvdata(pdev, bl); |
129 | 129 | ||
130 | return 0; | 130 | return 0; |
131 | 131 | ||
132 | error_backlight_device_register: | 132 | error_devm_kzalloc: |
133 | kfree(data); | ||
134 | error_kzalloc: | ||
135 | cs5535_mfgpt_free_timer(pwm_timer); | 133 | cs5535_mfgpt_free_timer(pwm_timer); |
136 | error_mfgpt_alloc: | 134 | error_mfgpt_alloc: |
137 | gpio_free(GPIO_DIMM); | 135 | gpio_free(GPIO_DIMM); |
@@ -141,7 +139,6 @@ error_mfgpt_alloc: | |||
141 | static int ot200_backlight_remove(struct platform_device *pdev) | 139 | static int ot200_backlight_remove(struct platform_device *pdev) |
142 | { | 140 | { |
143 | struct backlight_device *bl = platform_get_drvdata(pdev); | 141 | struct backlight_device *bl = platform_get_drvdata(pdev); |
144 | struct ot200_backlight_data *data = bl_get_data(bl); | ||
145 | 142 | ||
146 | backlight_device_unregister(bl); | 143 | backlight_device_unregister(bl); |
147 | 144 | ||
@@ -154,7 +151,6 @@ static int ot200_backlight_remove(struct platform_device *pdev) | |||
154 | cs5535_mfgpt_free_timer(pwm_timer); | 151 | cs5535_mfgpt_free_timer(pwm_timer); |
155 | gpio_free(GPIO_DIMM); | 152 | gpio_free(GPIO_DIMM); |
156 | 153 | ||
157 | kfree(data); | ||
158 | return 0; | 154 | return 0; |
159 | } | 155 | } |
160 | 156 | ||