diff options
author | Sudip Mukherjee <sudipm.mukherjee@gmail.com> | 2016-02-23 07:44:17 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-02-26 05:16:58 -0500 |
commit | 7fdfc702d301a127d875e5608342a249201fdb4a (patch) | |
tree | 46ea50c5e8bad93e8113915a7e57f173f5daac4b /drivers/video | |
parent | f059c4b220b821f8ed7b1b12387cce86373f666e (diff) |
fbdev: n411: check return value
We were not checking the return value of platform_device_add_data()
which can fail.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbdev/n411.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/video/fbdev/n411.c b/drivers/video/fbdev/n411.c index 935830fea7b6..053deacad7cc 100644 --- a/drivers/video/fbdev/n411.c +++ b/drivers/video/fbdev/n411.c | |||
@@ -165,16 +165,22 @@ static int __init n411_init(void) | |||
165 | if (!n411_device) | 165 | if (!n411_device) |
166 | return -ENOMEM; | 166 | return -ENOMEM; |
167 | 167 | ||
168 | platform_device_add_data(n411_device, &n411_board, sizeof(n411_board)); | 168 | ret = platform_device_add_data(n411_device, &n411_board, |
169 | sizeof(n411_board)); | ||
170 | if (ret) | ||
171 | goto put_plat_device; | ||
169 | 172 | ||
170 | /* this _add binds hecubafb to n411. hecubafb refcounts n411 */ | 173 | /* this _add binds hecubafb to n411. hecubafb refcounts n411 */ |
171 | ret = platform_device_add(n411_device); | 174 | ret = platform_device_add(n411_device); |
172 | 175 | ||
173 | if (ret) | 176 | if (ret) |
174 | platform_device_put(n411_device); | 177 | goto put_plat_device; |
175 | 178 | ||
176 | return ret; | 179 | return 0; |
177 | 180 | ||
181 | put_plat_device: | ||
182 | platform_device_put(n411_device); | ||
183 | return ret; | ||
178 | } | 184 | } |
179 | 185 | ||
180 | static void __exit n411_exit(void) | 186 | static void __exit n411_exit(void) |