video:uvesafb: Fix dereference NULL pointer code path

platform_device_alloc could failed and return NULL,
we should check this before call platform_device_put.

Signed-off-by: Wang YanQing <udknight@gmail.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
Wang YanQing 2013-03-30 04:53:00 +02:00 committed by Tomi Valkeinen
parent 477fc03f5b
commit 090da752cd
1 changed files with 2 additions and 1 deletions

View File

@ -1973,7 +1973,8 @@ static int uvesafb_init(void)
err = -ENOMEM;
if (err) {
platform_device_put(uvesafb_device);
if (uvesafb_device)
platform_device_put(uvesafb_device);
platform_driver_unregister(&uvesafb_driver);
cn_del_callback(&uvesafb_cn_id);
return err;