This patch removes this smatch warning: unsigned '--un->un_open_count' is never less than zero
The code decremented the un_open_count variable and tested to see if it was less than zero. Because un_open_count is unsigned and can't be below zero, this test didn't work. Signed-off-by: Lidza Louina <lidza.lou...@gmail.com> --- drivers/staging/dgap/dgap_tty.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/dgap/dgap_tty.c b/drivers/staging/dgap/dgap_tty.c index 501071f..57a2354 100644 --- a/drivers/staging/dgap/dgap_tty.c +++ b/drivers/staging/dgap/dgap_tty.c @@ -1456,12 +1456,13 @@ static void dgap_tty_close(struct tty_struct *tty, struct file *file) un->un_open_count = 1; } - if (--un->un_open_count < 0) { + if (--un->un_open_count == 0) { APR(("bad serial port open count of %d\n", un->un_open_count)); - un->un_open_count = 0; + un->un_open_count = 1; } ch->ch_open_count--; + un->un_open_count--; if (ch->ch_open_count && un->un_open_count) { DPR_CLOSE(("dgap_tty_close: not last close ch: %d un:%d\n", -- 1.8.1.2 _______________________________________________ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel