diff mbox series

[v2,21/28] video: fbdev: tmiofb: Fix set but not used warnings

Message ID 20201128224114.1033617-22-sam@ravnborg.org
State New
Headers show
Series drivers/video: W=1 warning fixes | expand

Commit Message

Sam Ravnborg Nov. 28, 2020, 10:41 p.m. UTC
Fix W=1 warnings by avoiding local variables and use direct references.

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
---
 drivers/video/fbdev/tmiofb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Thomas Zimmermann Nov. 30, 2020, 2:36 p.m. UTC | #1
Am 28.11.20 um 23:41 schrieb Sam Ravnborg:
> Fix W=1 warnings by avoiding local variables and use direct references.

What's the bug here?

> 
> v2:
>    - Updated subject (Lee)
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> ---
>   drivers/video/fbdev/tmiofb.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/fbdev/tmiofb.c b/drivers/video/fbdev/tmiofb.c
> index 50111966c981..b70faa3850f2 100644
> --- a/drivers/video/fbdev/tmiofb.c
> +++ b/drivers/video/fbdev/tmiofb.c
> @@ -802,10 +802,8 @@ static int tmiofb_remove(struct platform_device *dev)
>   	const struct mfd_cell *cell = mfd_get_cell(dev);
>   	struct fb_info *info = platform_get_drvdata(dev);
>   	int irq = platform_get_irq(dev, 0);
> -	struct tmiofb_par *par;
>   
>   	if (info) {
> -		par = info->par;
>   		unregister_framebuffer(info);
>   
>   		tmiofb_hw_stop(dev);
> @@ -816,8 +814,8 @@ static int tmiofb_remove(struct platform_device *dev)
>   		free_irq(irq, info);
>   
>   		iounmap(info->screen_base);
> -		iounmap(par->lcr);
> -		iounmap(par->ccr);
> +		iounmap(((struct tmiofb_par *)info->par)->lcr);
> +		iounmap(((struct tmiofb_par *)info->par)->ccr);
>   
>   		framebuffer_release(info);
>   	}
>
Sam Ravnborg Nov. 30, 2020, 6:46 p.m. UTC | #2
Hi Thomas,

On Mon, Nov 30, 2020 at 03:36:44PM +0100, Thomas Zimmermann wrote:
> 
> 
> Am 28.11.20 um 23:41 schrieb Sam Ravnborg:
> > Fix W=1 warnings by avoiding local variables and use direct references.
> 
> What's the bug here?

sh define iounmap like this:
#define iounmap(addr)		do { } while (0)

So par is not used resulting in a warning.

My patch just papers over the real issue.
The right fix is to fix sh so we reference addr.
Will give that a shot.

	Sam

> 
> > 
> > v2:
> >    - Updated subject (Lee)
> > 
> > Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Sam Ravnborg <sam@ravnborg.org>
> > Cc: Jani Nikula <jani.nikula@intel.com>
> > Cc: Lee Jones <lee.jones@linaro.org>
> > ---
> >   drivers/video/fbdev/tmiofb.c | 6 ++----
> >   1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/video/fbdev/tmiofb.c b/drivers/video/fbdev/tmiofb.c
> > index 50111966c981..b70faa3850f2 100644
> > --- a/drivers/video/fbdev/tmiofb.c
> > +++ b/drivers/video/fbdev/tmiofb.c
> > @@ -802,10 +802,8 @@ static int tmiofb_remove(struct platform_device *dev)
> >   	const struct mfd_cell *cell = mfd_get_cell(dev);
> >   	struct fb_info *info = platform_get_drvdata(dev);
> >   	int irq = platform_get_irq(dev, 0);
> > -	struct tmiofb_par *par;
> >   	if (info) {
> > -		par = info->par;
> >   		unregister_framebuffer(info);
> >   		tmiofb_hw_stop(dev);
> > @@ -816,8 +814,8 @@ static int tmiofb_remove(struct platform_device *dev)
> >   		free_irq(irq, info);
> >   		iounmap(info->screen_base);
> > -		iounmap(par->lcr);
> > -		iounmap(par->ccr);
> > +		iounmap(((struct tmiofb_par *)info->par)->lcr);
> > +		iounmap(((struct tmiofb_par *)info->par)->ccr);
> >   		framebuffer_release(info);
> >   	}
> > 
> 
> -- 
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>
diff mbox series

Patch

diff --git a/drivers/video/fbdev/tmiofb.c b/drivers/video/fbdev/tmiofb.c
index 50111966c981..b70faa3850f2 100644
--- a/drivers/video/fbdev/tmiofb.c
+++ b/drivers/video/fbdev/tmiofb.c
@@ -802,10 +802,8 @@  static int tmiofb_remove(struct platform_device *dev)
 	const struct mfd_cell *cell = mfd_get_cell(dev);
 	struct fb_info *info = platform_get_drvdata(dev);
 	int irq = platform_get_irq(dev, 0);
-	struct tmiofb_par *par;
 
 	if (info) {
-		par = info->par;
 		unregister_framebuffer(info);
 
 		tmiofb_hw_stop(dev);
@@ -816,8 +814,8 @@  static int tmiofb_remove(struct platform_device *dev)
 		free_irq(irq, info);
 
 		iounmap(info->screen_base);
-		iounmap(par->lcr);
-		iounmap(par->ccr);
+		iounmap(((struct tmiofb_par *)info->par)->lcr);
+		iounmap(((struct tmiofb_par *)info->par)->ccr);
 
 		framebuffer_release(info);
 	}