Skip to contentSkip to conversation

kstrtox: simpler code in _kstrtoull()

PATCH New Alexey Dobriyan 1 participant 1 message Mar 24, 2011 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kstrtox: simpler code in _kstrtoull()

---

 lib/kstrtox.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
lib/kstrtox.c +3 -6
@@ -49,12 +49,9 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
 			val = *s - '0';
 		else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f')
 			val = _tolower(*s) - 'a' + 10;
-		else if (*s == '\n') {
-			if (*(s + 1) == '\0')
-				break;
-			else
-				return -EINVAL;
-		} else
+		else if (*s == '\n' && *(s + 1) == '\0')
+			break;
+		else
 			return -EINVAL;
 
 		if (val >= base)