2005-04-23 11:11:45

by Jesper Juhl

[permalink] [raw]
Subject: [PATCH] keyboard: checking the same thing twice is pretty pointless

in drivers/char/keyboard.c::setkeycode two 'if' statements test exately
the same thing - one of them should go away, I removed the second one.
Since 'keycode' is an unsigned int it can never be <0 and the >KEY_MAX
check has just been performed by the 'if' above.

Signed-off-by: Jesper Juhl <[email protected]>
---

drivers/char/keyboard.c | 2 --
1 files changed, 2 deletions(-)

--- linux-2.6.12-rc2-mm3-orig/drivers/char/keyboard.c 2005-04-11 21:20:40.000000000 +0200
+++ linux-2.6.12-rc2-mm3/drivers/char/keyboard.c 2005-04-23 12:43:28.000000000 +0200
@@ -200,8 +200,6 @@ int setkeycode(unsigned int scancode, un
return -EINVAL;
if (keycode > KEY_MAX)
return -EINVAL;
- if (keycode < 0 || keycode > KEY_MAX)
- return -EINVAL;

oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode);