Re: [PATCH -next] 8250_men_mcb: Fix unsigned expression compared with zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03. 08. 23, 16:20, Li Zetao wrote:
There is a warning reported by coccinelle:

./drivers/tty/serial/8250/8250_men_mcb.c:226:6-19: WARNING:
	Unsigned expression compared with zero: data -> line [ i ]     <     0

The array "line" of serial_8250_men_mcb_data is used to record the
registered serial port. When register a port failed, it will return
an error code, but the type of "line" is "unsigned int", causing
the error code to reverse. Modify the type of "data -> line" to solve
this problem.

Fixes: 2554e6ba28a2 ("8250_men_mcb: Read num ports from register data.")
Signed-off-by: Li Zetao <lizetao1@xxxxxxxxxx>
---
  drivers/tty/serial/8250/8250_men_mcb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_men_mcb.c b/drivers/tty/serial/8250/8250_men_mcb.c
index 5f301195575d..14cf6011a002 100644
--- a/drivers/tty/serial/8250/8250_men_mcb.c
+++ b/drivers/tty/serial/8250/8250_men_mcb.c
@@ -46,7 +46,7 @@
struct serial_8250_men_mcb_data {
  	int num_ports;
-	unsigned int line[MAX_PORTS];
+	int line[MAX_PORTS];

LGTM

Reviewed-by: Jiri Slaby <jirislaby@xxxxxxxxxx>

But I wonder why this didn't emit a warning:
  dev_info(&mdev->dev, "found MCB UART: ttyS%d\n", data->line[i]);

I.e. %d for uint?

thanks,
--
js
suse labs




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux