lkml.org 
[lkml]   [2021]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] char: pcmcia: remove set but not used variable 'tmp'
On Fri, May 14, 2021 at 8:21 AM Yu Kuai <yukuai3@huawei.com> wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/char/pcmcia/cm4000_cs.c:1053:16: warning: variable ‘tmp’
> set but not used [-Wunused-but-set-variable]
>
> It is never used and so can be removed.
>
> Fixes: c1986ee9bea3 ("[PATCH] New Omnikey Cardman 4000 driver")
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>

Looks good to me. This was likely written that way at a time when some
architecture implemented inb() as a macro, and ignoring its value
would cause a different warning.

Since you are already touching this file, can you have a look at this
warning as well:

drivers/char/pcmcia/cm4000_cs.c: In function 'set_protocol':
>> drivers/char/pcmcia/cm4000_cs.c:569:16: warning: iteration 4 invokes undefined behavior [-Waggressive-loop-optimizations]
569 | pts_reply[i] = inb(REG_BUF_DATA(iobase));
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/char/pcmcia/cm4000_cs.c:567:2: note: within this loop
567 | for (i = 0; i < num_bytes_read; i++) {

This looks like a preexisting problem that was uncovered by a patch
that is now in linux-next to change the inb() definition once more,
I got a report from the kernel build bot about it after I merged the
patch into the asm-generic tree. It needs a range check on
num_bytes_read, or a Kconfig check to ensure it is not built on
architectures without working inb()/outb() operations.

Arnd

\
 
 \ /
  Last update: 2021-05-14 08:29    [W:0.038 / U:3.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site