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>
This commit is contained in:
Sudip Mukherjee 2016-02-23 18:14:17 +05:30 committed by Tomi Valkeinen
parent f059c4b220
commit 7fdfc702d3
1 changed files with 9 additions and 3 deletions

View File

@ -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 0;
put_plat_device:
platform_device_put(n411_device);
return ret;
}
static void __exit n411_exit(void)