* [PATCH] staging: fbtft: Remove set but not used variable 'ret'
@ 2019-11-10 10:57 Zheng Yongjun
2019-11-11 15:40 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2019-11-10 10:57 UTC (permalink / raw)
To: gregkh, dri-devel, davem; +Cc: linux-kernel, zhengyongjun3, Hulk Robot
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/staging/fbtft/fb_ili9320.c: In function read_devicecode:
drivers/staging/fbtft/fb_ili9320.c:25:6: warning: variable ret set but not used [-Wunused-but-set-variable]
ret is never used, so remove it.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/staging/fbtft/fb_ili9320.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/fbtft/fb_ili9320.c b/drivers/staging/fbtft/fb_ili9320.c
index f2e72d14431d..f0ebc40857b3 100644
--- a/drivers/staging/fbtft/fb_ili9320.c
+++ b/drivers/staging/fbtft/fb_ili9320.c
@@ -22,11 +22,10 @@
static unsigned int read_devicecode(struct fbtft_par *par)
{
- int ret;
u8 rxbuf[8] = {0, };
write_reg(par, 0x0000);
- ret = par->fbtftops.read(par, rxbuf, 4);
+ par->fbtftops.read(par, rxbuf, 4);
return (rxbuf[2] << 8) | rxbuf[3];
}
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: fbtft: Remove set but not used variable 'ret'
2019-11-10 10:57 [PATCH] staging: fbtft: Remove set but not used variable 'ret' Zheng Yongjun
@ 2019-11-11 15:40 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2019-11-11 15:40 UTC (permalink / raw)
To: Zheng Yongjun; +Cc: dri-devel, davem, linux-kernel, Hulk Robot
On Sun, Nov 10, 2019 at 06:57:07PM +0800, Zheng Yongjun wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/staging/fbtft/fb_ili9320.c: In function read_devicecode:
> drivers/staging/fbtft/fb_ili9320.c:25:6: warning: variable ret set but not used [-Wunused-but-set-variable]
>
> ret is never used, so remove it.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
> ---
> drivers/staging/fbtft/fb_ili9320.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/fbtft/fb_ili9320.c b/drivers/staging/fbtft/fb_ili9320.c
> index f2e72d14431d..f0ebc40857b3 100644
> --- a/drivers/staging/fbtft/fb_ili9320.c
> +++ b/drivers/staging/fbtft/fb_ili9320.c
> @@ -22,11 +22,10 @@
>
> static unsigned int read_devicecode(struct fbtft_par *par)
> {
> - int ret;
> u8 rxbuf[8] = {0, };
>
> write_reg(par, 0x0000);
> - ret = par->fbtftops.read(par, rxbuf, 4);
> + par->fbtftops.read(par, rxbuf, 4);
> return (rxbuf[2] << 8) | rxbuf[3];
> }
>
If the read call can fail, shouldn't you be passing back the error
value instead?
thanks,
greg k-h
> --
> 2.23.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-11 15:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-10 10:57 [PATCH] staging: fbtft: Remove set but not used variable 'ret' Zheng Yongjun
2019-11-11 15:40 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).