Skip to contentSkip to conversation

pcmcia/cm4000: remove useless variable tmp

PATCH In review Alex Shi 3 participants 5 messages Jan 21, 2020 Char and misc drivers

lore
Share & tools
lore

Alex Shi

author
#0 lore raw

PATCH 1/1 pcmcia/cm4000: remove useless variable tmp

No one care the value of 'tmp' in func cmm_write. better to remove it.

Cc Harald Welte <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/char/pcmcia/cm4000_cs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/char/pcmcia/cm4000_cs.c +1 -2
index 15bf585af5d3..9be3917b6d6c 100644
@@ -1048,7 +1048,6 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
 	struct cm4000_dev *dev = filp->private_data;
 	unsigned int iobase = dev->p_dev->resource[0]->start;
 	unsigned short s;
-	unsigned char tmp;
 	unsigned char infolen;
 	unsigned char sendT0;
 	unsigned short nsend;
@@ -1146,7 +1145,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
 	set_cardparameter(dev);
 
 	/* dummy read, reset flag procedure received */
-	tmp = inb(REG_FLAGS1(iobase));
+	inb(REG_FLAGS1(iobase));
 
 	dev->flags1 = 0x20	/* T_Active */
 	    | (sendT0)
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 2 lines · Alex Shi

No one care the value of 'tmp' in func cmm_write. better to remove it.

Hi Alex,

drivers/char/pcmcia/cm4000_cs.c static ssize_t cmm_write(struct file *filp, const char __user *buf, · line 1148

Quoted 6 lines
drivers/char/pcmcia/cm4000_cs.c +1 -1
@@ -1146,7 +1145,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
        set_cardparameter(dev);
 
        /* dummy read, reset flag procedure received */
-       tmp = inb(REG_FLAGS1(iobase));
+       inb(REG_FLAGS1(iobase));

I think this may cause warnings on some architectures, when inb() is a macro that just turns into a pointer dereference. You could write it as

     (void)inb(REG_FLAGS1(iobase));

which would not warn anywhere.

Arnd

author
#2 lore raw
Quoted 16 lines · Arnd Bergmann
Quoted 2 lines · Alex Shi

No one care the value of 'tmp' in func cmm_write. better to remove it.

Hi Alex,

Review static ssize_t cmm_write(struct file *filp, const char __user *buf, · line 1148

Quoted 6 lines
(quoted diff) +1 -1
@@ -1146,7 +1145,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
        set_cardparameter(dev);
 
        /* dummy read, reset flag procedure received */
-       tmp = inb(REG_FLAGS1(iobase));
+       inb(REG_FLAGS1(iobase));

I think this may cause warnings on some architectures, when inb() is a macro that just turns into a pointer dereference. You could write it as

Quoted 6 lines
     (void)inb(REG_FLAGS1(iobase));

which would not warn anywhere.

Arnd

Thanks a lot Arnd!

From 9e54770c6911ae7da7d2f74774bbef019e459bc9 Mon Sep 17 00:00:00 2001
From: Alex Shi <[email protected]>
Date: Fri, 17 Jan 2020 09:10:47 +0800
Subject: [PATCH v2] pcmcia/cm4000: remove useless variable tmp

No one care the value of 'tmp' in func cmm_write. better to remove it.

Arnd Bergmann pointed just remove may cause warning in some arch where inb is macro, and suggest add a cast '(void)' for this. Thanks!

Cc Harald Welte <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/char/pcmcia/cm4000_cs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/char/pcmcia/cm4000_cs.c +1 -2
index 15bf585af5d3..0f55bed6c71f 100644
@@ -1048,7 +1048,6 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
 	struct cm4000_dev *dev = filp->private_data;
 	unsigned int iobase = dev->p_dev->resource[0]->start;
 	unsigned short s;
-	unsigned char tmp;
 	unsigned char infolen;
 	unsigned char sendT0;
 	unsigned short nsend;
@@ -1146,7 +1145,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
 	set_cardparameter(dev);
 
 	/* dummy read, reset flag procedure received */
-	tmp = inb(REG_FLAGS1(iobase));
+	(void)inb(REG_FLAGS1(iobase));
 
 	dev->flags1 = 0x20	/* T_Active */
 	    | (sendT0)
Signature · 1 line
1.8.3.1
maintainer Acked-by
#3 lore raw
Quoted 8 lines · Alex Shi

From 9e54770c6911ae7da7d2f74774bbef019e459bc9 Mon Sep 17 00:00:00 2001
From: Alex Shi <[email protected]>
Date: Fri, 17 Jan 2020 09:10:47 +0800
Subject: [PATCH v2] pcmcia/cm4000: remove useless variable tmp

No one care the value of 'tmp' in func cmm_write. better to remove it.

Quoted 8 lines

Arnd Bergmann pointed just remove may cause warning in some arch where inb is macro, and suggest add a cast '(void)' for this. Thanks!

Cc Harald Welte <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
#4 lore raw
In reply to Alex Shi
Quoted 61 lines · Alex Shi
Quoted 16 lines · Arnd Bergmann
Quoted 2 lines · Alex Shi

No one care the value of 'tmp' in func cmm_write. better to remove it.

Hi Alex,

drivers/char/pcmcia/cm4000_cs.c static ssize_t cmm_write(struct file *filp, const char __user *buf, · line 1148

Quoted 6 lines
drivers/char/pcmcia/cm4000_cs.c +1 -1
@@ -1146,7 +1145,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
        set_cardparameter(dev);
 
        /* dummy read, reset flag procedure received */
-       tmp = inb(REG_FLAGS1(iobase));
+       inb(REG_FLAGS1(iobase));

I think this may cause warnings on some architectures, when inb() is a macro that just turns into a pointer dereference. You could write it as

Quoted 6 lines
     (void)inb(REG_FLAGS1(iobase));

which would not warn anywhere.

Arnd

Thanks a lot Arnd!

Quoted 1 line

From 9e54770c6911ae7da7d2f74774bbef019e459bc9 Mon Sep 17 00:00:00 2001

From: Alex Shi <[email protected]>
Date: Fri, 17 Jan 2020 09:10:47 +0800
Subject: [PATCH v2] pcmcia/cm4000: remove useless variable tmp

No one care the value of 'tmp' in func cmm_write. better to remove it.

Arnd Bergmann pointed just remove may cause warning in some arch where inb is macro, and suggest add a cast '(void)' for this. Thanks!

Cc Harald Welte <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/char/pcmcia/cm4000_cs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/char/pcmcia/cm4000_cs.c +0 -1
index 15bf585af5d3..0f55bed6c71f 100644
@@ -1048,7 +1048,6 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
 	struct cm4000_dev *dev = filp->private_data;
 	unsigned int iobase = dev->p_dev->resource[0]->start;
 	unsigned short s;
-	unsigned char tmp;
 	unsigned char infolen;
 	unsigned char sendT0;
 	unsigned short nsend;

drivers/char/pcmcia/cm4000_cs.c static ssize_t cmm_write(struct file *filp, const char __user *buf, · line 1148

Quoted 5 lines
drivers/char/pcmcia/cm4000_cs.c +1 -1
@@ -1146,7 +1145,7 @@ static ssize_t cmm_write(struct file *filp, const char __user *buf,
 	set_cardparameter(dev);
 
 	/* dummy read, reset flag procedure received */
-	tmp = inb(REG_FLAGS1(iobase));
+	(void)inb(REG_FLAGS1(iobase));

That's horrid, just keep tmp :)