On Fri, May 14, 2021 at 8:21 AM Yu Kuai <yukuai3@xxxxxxxxxx> wrote:Hi,
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@xxxxxxxxxx>
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':
569 | pts_reply[i] = inb(REG_BUF_DATA(iobase));drivers/char/pcmcia/cm4000_cs.c:569:16: warning: iteration 4 invokes undefined behavior [-Waggressive-loop-optimizations]
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
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
.