From: Sudip Mukherjee Date: Thu, 9 Nov 2017 17:09:31 +0000 (+0100) Subject: sm501fb: unregister framebuffer only if registered X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=35bfbf70b2928ce5fbc117a410915eeee457202b;p=linux.git sm501fb: unregister framebuffer only if registered There are cases when panel and crt both are not defined and only one of them is defined and initialized. In such cases, while removing the device, unregister the framebuffer only if it was registered. Signed-off-by: Sudip Mukherjee Signed-off-by: Bartlomiej Zolnierkiewicz --- diff --git a/drivers/video/fbdev/sm501fb.c b/drivers/video/fbdev/sm501fb.c index 381475fa137b5..577a48339bab1 100644 --- a/drivers/video/fbdev/sm501fb.c +++ b/drivers/video/fbdev/sm501fb.c @@ -2079,8 +2079,10 @@ static int sm501fb_remove(struct platform_device *pdev) sm501_free_init_fb(info, HEAD_CRT); sm501_free_init_fb(info, HEAD_PANEL); - unregister_framebuffer(fbinfo_crt); - unregister_framebuffer(fbinfo_pnl); + if (fbinfo_crt) + unregister_framebuffer(fbinfo_crt); + if (fbinfo_pnl) + unregister_framebuffer(fbinfo_pnl); sm501fb_stop(info); kfree(info);