Skip to content

Commit

Permalink
video:uvesafb: Fix dereference NULL pointer code path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wang YanQing authored and Tomi Valkeinen committed Apr 2, 2013
1 parent 477fc03 commit 090da75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/video/uvesafb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 090da75

Please sign in to comment.