diff mbox series

[2/2] spi: npcm: Remove set but not used variable 'val'

Message ID 1570523497-112804-3-git-send-email-zhengbin13@huawei.com (mailing list archive)
State Superseded
Headers show
Series spi: Remove two set but not used variables | expand

Commit Message

Zheng Bin Oct. 8, 2019, 8:31 a.m. UTC
Fixes gcc '-Wunused-but-set-variable' warning:

drivers/spi/spi-npcm-pspi.c: In function npcm_pspi_handler:
drivers/spi/spi-npcm-pspi.c:296:6: warning: variable val set but not used [-Wunused-but-set-variable]

It is not used since commit 2a22f1b30cee ("spi:
npcm: add NPCM PSPI controller driver")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
 drivers/spi/spi-npcm-pspi.c | 2 --
 1 file changed, 2 deletions(-)

--
2.7.4

Comments

Geert Uytterhoeven Oct. 8, 2019, 9 a.m. UTC | #1
Hi Zhengbin,

On Tue, Oct 8, 2019 at 10:25 AM zhengbin <zhengbin13@huawei.com> wrote:
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/spi/spi-npcm-pspi.c: In function npcm_pspi_handler:
> drivers/spi/spi-npcm-pspi.c:296:6: warning: variable val set but not used [-Wunused-but-set-variable]
>
> It is not used since commit 2a22f1b30cee ("spi:
> npcm: add NPCM PSPI controller driver")
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>

Have you tested this on actual hardware?
Are you sure the hardware does not require reading this register to work
properly?

> --- a/drivers/spi/spi-npcm-pspi.c
> +++ b/drivers/spi/spi-npcm-pspi.c
> @@ -293,7 +293,6 @@ static void npcm_pspi_reset_hw(struct npcm_pspi *priv)
>  static irqreturn_t npcm_pspi_handler(int irq, void *dev_id)
>  {
>         struct npcm_pspi *priv = dev_id;
> -       u16 val;
>         u8 stat;
>
>         stat = ioread8(priv->base + NPCM_PSPI_STAT);
> @@ -303,7 +302,6 @@ static irqreturn_t npcm_pspi_handler(int irq, void *dev_id)
>
>         if (priv->tx_buf) {
>                 if (stat & NPCM_PSPI_STAT_RBF) {
> -                       val = ioread8(NPCM_PSPI_DATA + priv->base);
>                         if (priv->tx_bytes == 0) {
>                                 npcm_pspi_disable(priv);
>                                 complete(&priv->xfer_done);

Gr{oetje,eeting}s,

                        Geert
Zheng Bin Oct. 8, 2019, 9:27 a.m. UTC | #2
On 2019/10/8 17:00, Geert Uytterhoeven wrote:
> Hi Zhengbin,
>
> On Tue, Oct 8, 2019 at 10:25 AM zhengbin <zhengbin13@huawei.com> wrote:
>> Fixes gcc '-Wunused-but-set-variable' warning:
>>
>> drivers/spi/spi-npcm-pspi.c: In function npcm_pspi_handler:
>> drivers/spi/spi-npcm-pspi.c:296:6: warning: variable val set but not used [-Wunused-but-set-variable]
>>
>> It is not used since commit 2a22f1b30cee ("spi:
>> npcm: add NPCM PSPI controller driver")
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: zhengbin <zhengbin13@huawei.com>
> Have you tested this on actual hardware?
> Are you sure the hardware does not require reading this register to work
> properly?

oops, my mistake, sorry for the noise.

marybe we can just remove val, and callĀ  ioread8(NPCM_PSPI_DATA + priv->base); ?

to avoid this warning?


>> --- a/drivers/spi/spi-npcm-pspi.c
>> +++ b/drivers/spi/spi-npcm-pspi.c
>> @@ -293,7 +293,6 @@ static void npcm_pspi_reset_hw(struct npcm_pspi *priv)
>>  static irqreturn_t npcm_pspi_handler(int irq, void *dev_id)
>>  {
>>         struct npcm_pspi *priv = dev_id;
>> -       u16 val;
>>         u8 stat;
>>
>>         stat = ioread8(priv->base + NPCM_PSPI_STAT);
>> @@ -303,7 +302,6 @@ static irqreturn_t npcm_pspi_handler(int irq, void *dev_id)
>>
>>         if (priv->tx_buf) {
>>                 if (stat & NPCM_PSPI_STAT_RBF) {
>> -                       val = ioread8(NPCM_PSPI_DATA + priv->base);
>>                         if (priv->tx_bytes == 0) {
>>                                 npcm_pspi_disable(priv);
>>                                 complete(&priv->xfer_done);
> Gr{oetje,eeting}s,
>
>                         Geert
>
diff mbox series

Patch

diff --git a/drivers/spi/spi-npcm-pspi.c b/drivers/spi/spi-npcm-pspi.c
index b191d57..aff7059 100644
--- a/drivers/spi/spi-npcm-pspi.c
+++ b/drivers/spi/spi-npcm-pspi.c
@@ -293,7 +293,6 @@  static void npcm_pspi_reset_hw(struct npcm_pspi *priv)
 static irqreturn_t npcm_pspi_handler(int irq, void *dev_id)
 {
 	struct npcm_pspi *priv = dev_id;
-	u16 val;
 	u8 stat;

 	stat = ioread8(priv->base + NPCM_PSPI_STAT);
@@ -303,7 +302,6 @@  static irqreturn_t npcm_pspi_handler(int irq, void *dev_id)

 	if (priv->tx_buf) {
 		if (stat & NPCM_PSPI_STAT_RBF) {
-			val = ioread8(NPCM_PSPI_DATA + priv->base);
 			if (priv->tx_bytes == 0) {
 				npcm_pspi_disable(priv);
 				complete(&priv->xfer_done);