Skip to contentSkip to conversation

staging: dgnc: Fix unsigned value for less than zero

PATCH New Daeseok Youn 1 participant 1 message Jul 3, 2014 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 staging: dgnc: Fix unsigned value for less than zero

The "un->un_open_count" is unsigned variable, so it cannot be less than zero.

---
 drivers/staging/dgnc/dgnc_tty.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/dgnc/dgnc_tty.c +3 -3
index 8081621..f7409d9 100644
@@ -1636,10 +1636,10 @@ static void dgnc_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)
+		un->un_open_count--;
+	else
 		APR(("bad serial port open count of %d\n", un->un_open_count));
-		un->un_open_count = 0;
-	}
 
 	ch->ch_open_count--;
 
Signature · 1 line
1.7.1