Skip to content

Commit

Permalink
8250_men_mcb: Fix unsigned expression compared with zero
Browse files Browse the repository at this point in the history
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: 2554e6b ("8250_men_mcb: Read num ports from register data.")
Signed-off-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230803142053.1308926-1-lizetao1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Li Zetao authored and Greg Kroah-Hartman committed Aug 4, 2023
1 parent 4b37932 commit b581686
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_men_mcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

struct serial_8250_men_mcb_data {
int num_ports;
unsigned int line[MAX_PORTS];
int line[MAX_PORTS];
unsigned int offset[MAX_PORTS];
};

Expand Down

0 comments on commit b581686

Please sign in to comment.