fbdev: s1d13xxxfb: add missed unregister_framebuffer in remove
Subsystems (2)
PATCH v2 1/1 fbdev: s1d13xxxfb: add missed unregister_framebuffer in remove
The driver calls register_framebuffer() in probe but does not call unregister_framebuffer() in remove.
Rename current remove to __s1d13xxxfb_remove() for error handler. Then add a new remove to call unregister_framebuffer().
---
Changes in v2:
- Rename the existing remove and add a new one to ensure the correctness of error handler in probe.
drivers/video/fbdev/s1d13xxxfb.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/video/fbdev/s1d13xxxfb.c +14 -3
@@ -721,9 +721,8 @@ static void s1d13xxxfb_fetch_hw_state(struct fb_info *info) xres, yres, xres_virtual, yres_virtual, is_color, is_dual, is_tft); } -static int -s1d13xxxfb_remove (struct platform_device *pdev) +__s1d13xxxfb_remove (struct platform_device *pdev) {struct fb_info *info =platform_get_drvdata (pdev);struct s1d13xxxfb_par *par =NULL ;
@@ -752,6 +751,18 @@ s1d13xxxfb_remove(struct platform_device *pdev)return 0 ; } +static int +s1d13xxxfb_remove (struct platform_device *pdev) +{ +struct fb_info *info =platform_get_drvdata (pdev); + +if (info) +unregister_framebuffer (info); + +return __s1d13xxxfb_remove (pdev); +} + +static int s1d13xxxfb_probe (struct platform_device *pdev) {struct s1d13xxxfb_par *default_par;
@@ -895,7 +906,7 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)return 0 ; bail: -s1d13xxxfb_remove (pdev); +__s1d13xxxfb_remove (pdev);return ret; }
Signature · 1 line
2.25.1
Quoted 19 lines · Chuhong Yuan
The driver calls
register_framebuffer()in probe but does not callunregister_framebuffer()in remove.
Rename current remove to__s1d13xxxfb_remove()for error handler. Then add a new remove to callunregister_framebuffer().Signed-off-by Chuhong Yuan <[email protected]>---
Changes in v2:
- Rename the existing remove and add a new one to ensure the correctness of error handler in probe.drivers/video/fbdev/s1d13xxxfb.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)drivers/video/fbdev/s1d13xxxfb.c +0
-0
drivers/video/fbdev/s1d13xxxfb.c static void s1d13xxxfb_fetch_hw_state(struct fb_info *info) · line 725
Quoted 7 lines
drivers/video/fbdev/s1d13xxxfb.c +1
-2@@ -721,9 +721,8 @@ static void s1d13xxxfb_fetch_hw_state(struct fb_info *info) xres, yres, xres_virtual, yres_virtual, is_color, is_dual, is_tft); } -static int -s1d13xxxfb_remove (struct platform_device *pdev) +__s1d13xxxfb_remove (struct platform_device *pdev)
The new function can be made void as it always returns 0.
Also please use the standard CodingStyle while at it:
void __s1d13xxxfb_remove(struct platform_device *pdev)
drivers/video/fbdev/s1d13xxxfb.c s1d13xxxfb_remove(struct platform_device *pdev) · line 755
Quoted 9 lines
drivers/video/fbdev/s1d13xxxfb.c +2
-0{struct fb_info *info =platform_get_drvdata (pdev);struct s1d13xxxfb_par *par =NULL ;@@ -752,6 +751,18 @@ s1d13xxxfb_remove(struct platform_device *pdev)return 0 ; } +static int +s1d13xxxfb_remove (struct platform_device *pdev)
Please use the standard CodingStyle while at it:
static int s1d13xxxfb_remove(struct platform_device *pdev)
drivers/video/fbdev/s1d13xxxfb.c s1d13xxxfb_remove(struct platform_device *pdev) · line 759
Quoted 4 lines
drivers/video/fbdev/s1d13xxxfb.c +4
-0+{ +struct fb_info *info =platform_get_drvdata (pdev); + +if (info)
'info' check is superfluous in the ->remove only code-path.
Quoted 11 lines
drivers/video/fbdev/s1d13xxxfb.c +6
-0+unregister_framebuffer (info); + +return __s1d13xxxfb_remove (pdev); +} + +static int s1d13xxxfb_probe (struct platform_device *pdev) {struct s1d13xxxfb_par *default_par;
drivers/video/fbdev/s1d13xxxfb.c static int s1d13xxxfb_probe(struct platform_device *pdev) · line 912
Quoted 8 lines
drivers/video/fbdev/s1d13xxxfb.c +1
-1@@ -895,7 +906,7 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)return 0 ; bail: -s1d13xxxfb_remove (pdev); +__s1d13xxxfb_remove (pdev);return ret; }
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics