summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2016-02-23 18:14:17 +0530
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-02-26 12:16:58 +0200
commit7fdfc702d301a127d875e5608342a249201fdb4a (patch)
tree46ea50c5e8bad93e8113915a7e57f173f5daac4b /drivers/video
parentf059c4b220b821f8ed7b1b12387cce86373f666e (diff)
downloadlinux-7fdfc702d301a127d875e5608342a249201fdb4a.tar.bz2
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.c12
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)
if (!n411_device)
return -ENOMEM;
- platform_device_add_data(n411_device, &n411_board, sizeof(n411_board));
+ ret = platform_device_add_data(n411_device, &n411_board,
+ sizeof(n411_board));
+ if (ret)
+ goto put_plat_device;
/* this _add binds hecubafb to n411. hecubafb refcounts n411 */
ret = platform_device_add(n411_device);
if (ret)
- platform_device_put(n411_device);
+ goto put_plat_device;
- return ret;
+ return 0;
+put_plat_device:
+ platform_device_put(n411_device);
+ return ret;
}
static void __exit n411_exit(void)