diff options
| author | Jiapeng Chong <[email protected]> | 2023-08-03 16:47:53 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2023-08-04 15:06:51 +0200 |
| commit | fcb451ff66b4e07de78faefb07549b139b54b943 (patch) | |
| tree | 8930f45bfda6e4f5358fe07def83dc3990eed958 | |
| parent | c58f2ae0ee94901da078a60961262df03eab7552 (diff) | |
8250_men_mcb: Fix unsigned comparison with less than zero
The data->line[i] is defined as unsigned int type, if(data->line[i] < 0)
is invalid, so replace data->line[i] with res.
./drivers/tty/serial/8250/8250_men_mcb.c:223:6-19: WARNING: Unsigned expression compared with zero: data->line[i] < 0.
Reported-by: Abaci Robot <[email protected]>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6088
Signed-off-by: Jiapeng Chong <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
| -rw-r--r-- | drivers/tty/serial/8250/8250_men_mcb.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/tty/serial/8250/8250_men_mcb.c b/drivers/tty/serial/8250/8250_men_mcb.c index 5f301195575d..c27c52d18dfa 100644 --- a/drivers/tty/serial/8250/8250_men_mcb.c +++ b/drivers/tty/serial/8250/8250_men_mcb.c @@ -222,11 +222,13 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, + data->offset[i]; /* ok, register the port */ - data->line[i] = serial8250_register_8250_port(&uart); - if (data->line[i] < 0) { + res = serial8250_register_8250_port(&uart); + if (res < 0) { dev_err(&mdev->dev, "unable to register UART port\n"); - return data->line[i]; + return res; } + + data->line[i] = res; dev_info(&mdev->dev, "found MCB UART: ttyS%d\n", data->line[i]); } |