video: fbdev: arcfb: add missed free_irq and fix the order of request_irq
Subsystems (2)
PATCH v3 1/1 video: fbdev: arcfb: add missed free_irq and fix the order of request_irq
The driver forgets to free irq in remove which is requested in probe.
Add the missed call to fix it.
Also, the position of request_irq() in probe should be put before register_framebuffer().
---
Changes in v3:
- Add missed variable par in remove.
drivers/video/fbdev/arcfb.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/video/fbdev/arcfb.c +7 -4
@@ -544,10 +544,6 @@ static int arcfb_probe(struct platform_device *dev) par->cslut[1 ] =0x06 ; info->flags =FBINFO_FLAG_DEFAULT ;spin_lock_init (&par->lock); - retval =register_framebuffer (info); -if (retval <0 ) - goto err1; -platform_set_drvdata (dev, info);if (irq) { par->irq = irq; if (request_irq(par->irq, &arcfb_interrupt, IRQF_SHARED,
@@ -558,6 +554,10 @@ static int arcfb_probe(struct platform_device *dev) goto err1; } } + retval =register_framebuffer (info); +if (retval <0 ) + goto err1; +platform_set_drvdata (dev, info);fb_info (info,"Arc frame buffer device, using %dK of video memory\n" , videomemorysize >>10 );
@@ -590,9 +590,12 @@ static int arcfb_probe(struct platform_device *dev)static int arcfb_remove (struct platform_device *dev) {struct fb_info *info =platform_get_drvdata (dev); +struct arcfb_par *par = info->par;if (info) {unregister_framebuffer (info); +if (irq) +free_irq (par->irq, info);vfree ((void __force *)info->screen_base);framebuffer_release (info); }
Signature · 1 line
2.25.1
Quoted 41 lines · Chuhong Yuan
The driver forgets to free irq in remove which is requested in probe.
Add the missed call to fix it.
Also, the position ofrequest_irq()in probe should be put beforeregister_framebuffer().Signed-off-by Chuhong Yuan <[email protected]>---
Changes in v3:
- Add missed variable par in remove.drivers/video/fbdev/arcfb.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)drivers/video/fbdev/arcfb.c +4
-4@@ -544,10 +544,6 @@ static int arcfb_probe(struct platform_device *dev) par->cslut[1 ] =0x06 ; info->flags =FBINFO_FLAG_DEFAULT ;spin_lock_init (&par->lock); - retval =register_framebuffer (info); -if (retval <0 ) - goto err1; -platform_set_drvdata (dev, info);if (irq) { par->irq = irq; if (request_irq(par->irq, &arcfb_interrupt, IRQF_SHARED,@@ -558,6 +554,10 @@ static int arcfb_probe(struct platform_device *dev) goto err1; } } + retval =register_framebuffer (info); +if (retval <0 ) + goto err1; +platform_set_drvdata (dev, info);fb_info (info,"Arc frame buffer device, using %dK of video memory\n" , videomemorysize >>10 );
drivers/video/fbdev/arcfb.c static int arcfb_probe(struct platform_device *dev) · line 593
Quoted 4 lines
drivers/video/fbdev/arcfb.c +1
-0@@ -590,9 +590,12 @@ static int arcfb_probe(struct platform_device *dev)static int arcfb_remove (struct platform_device *dev) {struct fb_info *info =platform_get_drvdata (dev); +struct arcfb_par *par = info->par;
Please look at the line below, 'info' is checked for being NULL so either 'par = info->par' can dereference NULL pointer or the check is superfluous and should be removed.
Also there is no need for 'par' variable (it is used only once), why not simply use info->par->irq in free_irq() call below?
drivers/video/fbdev/arcfb.c static int arcfb_probe(struct platform_device *dev) · line 601
Quoted 7 lines
drivers/video/fbdev/arcfb.c +2
-0if (info) {unregister_framebuffer (info); +if (irq) +free_irq (par->irq, info);vfree ((void __force *)info->screen_base);framebuffer_release (info); }
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics