* [PATCH] pcmcia/cm4000: remove useless variable tmp
@ 2020-01-21 8:49 Alex Shi
2020-01-21 9:08 ` Arnd Bergmann
0 siblings, 1 reply; 5+ messages in thread
From: Alex Shi @ 2020-01-21 8:49 UTC (permalink / raw)
Cc: Harald Welte, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel
No one care the value of 'tmp' in func cmm_write. better to remove it.
Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Harald Welte <laforge@gnumonks.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
---
drivers/char/pcmcia/cm4000_cs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 15bf585af5d3..9be3917b6d6c 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -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)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] pcmcia/cm4000: remove useless variable tmp
2020-01-21 8:49 [PATCH] pcmcia/cm4000: remove useless variable tmp Alex Shi
@ 2020-01-21 9:08 ` Arnd Bergmann
2020-01-21 9:53 ` Alex Shi
0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2020-01-21 9:08 UTC (permalink / raw)
To: Alex Shi; +Cc: Harald Welte, Greg Kroah-Hartman, linux-kernel
On Tue, Jan 21, 2020 at 9:50 AM Alex Shi <alex.shi@linux.alibaba.com> wrote:
>
> No one care the value of 'tmp' in func cmm_write. better to remove it.
Hi Alex,
> @@ -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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pcmcia/cm4000: remove useless variable tmp
2020-01-21 9:08 ` Arnd Bergmann
@ 2020-01-21 9:53 ` Alex Shi
2020-01-21 10:13 ` Arnd Bergmann
2020-01-21 16:24 ` Greg Kroah-Hartman
0 siblings, 2 replies; 5+ messages in thread
From: Alex Shi @ 2020-01-21 9:53 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Harald Welte, Greg Kroah-Hartman, linux-kernel
在 2020/1/21 下午5:08, Arnd Bergmann 写道:
> On Tue, Jan 21, 2020 at 9:50 AM Alex Shi <alex.shi@linux.alibaba.com> wrote:
>>
>> No one care the value of 'tmp' in func cmm_write. better to remove it.
>
> Hi Alex,
>
>> @@ -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
>
Thanks a lot Arnd!
From 9e54770c6911ae7da7d2f74774bbef019e459bc9 Mon Sep 17 00:00:00 2001
From: Alex Shi <alex.shi@linux.alibaba.com>
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!
Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
Cc: Harald Welte <laforge@gnumonks.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
---
drivers/char/pcmcia/cm4000_cs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 15bf585af5d3..0f55bed6c71f 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -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)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] pcmcia/cm4000: remove useless variable tmp
2020-01-21 9:53 ` Alex Shi
@ 2020-01-21 10:13 ` Arnd Bergmann
2020-01-21 16:24 ` Greg Kroah-Hartman
1 sibling, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2020-01-21 10:13 UTC (permalink / raw)
To: Alex Shi; +Cc: Harald Welte, Greg Kroah-Hartman, linux-kernel
On Tue, Jan 21, 2020 at 10:55 AM Alex Shi <alex.shi@linux.alibaba.com> wrote:
>
> From 9e54770c6911ae7da7d2f74774bbef019e459bc9 Mon Sep 17 00:00:00 2001
> From: Alex Shi <alex.shi@linux.alibaba.com>
> 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!
>
> Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
> Cc: Harald Welte <laforge@gnumonks.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-kernel@vger.kernel.org
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] pcmcia/cm4000: remove useless variable tmp
2020-01-21 9:53 ` Alex Shi
2020-01-21 10:13 ` Arnd Bergmann
@ 2020-01-21 16:24 ` Greg Kroah-Hartman
1 sibling, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2020-01-21 16:24 UTC (permalink / raw)
To: Alex Shi; +Cc: Arnd Bergmann, Harald Welte, linux-kernel
On Tue, Jan 21, 2020 at 05:53:53PM +0800, Alex Shi wrote:
>
>
> 在 2020/1/21 下午5:08, Arnd Bergmann 写道:
> > On Tue, Jan 21, 2020 at 9:50 AM Alex Shi <alex.shi@linux.alibaba.com> wrote:
> >>
> >> No one care the value of 'tmp' in func cmm_write. better to remove it.
> >
> > Hi Alex,
> >
> >> @@ -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
> >
>
> Thanks a lot Arnd!
>
>
> >From 9e54770c6911ae7da7d2f74774bbef019e459bc9 Mon Sep 17 00:00:00 2001
> From: Alex Shi <alex.shi@linux.alibaba.com>
> 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!
>
> Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
> Cc: Harald Welte <laforge@gnumonks.org>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/char/pcmcia/cm4000_cs.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
> index 15bf585af5d3..0f55bed6c71f 100644
> --- a/drivers/char/pcmcia/cm4000_cs.c
> +++ b/drivers/char/pcmcia/cm4000_cs.c
> @@ -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));
That's horrid, just keep tmp :)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-01-21 16:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21 8:49 [PATCH] pcmcia/cm4000: remove useless variable tmp Alex Shi
2020-01-21 9:08 ` Arnd Bergmann
2020-01-21 9:53 ` Alex Shi
2020-01-21 10:13 ` Arnd Bergmann
2020-01-21 16:24 ` Greg Kroah-Hartman
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).