diff options
author | Ryan CHEN <ryan.chen@st.com> | 2008-08-20 13:00:17 -0400 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-09-09 17:02:59 +0200 |
commit | 3b20fd83c73c22acfcb0c6663be747bd5c8b7011 (patch) | |
tree | 30732e12d39390eda22338e98db7b8ab9025bf22 | |
parent | eba1f2fc75f128a9a6c1328d786996a93fd7a707 (diff) |
Correct drv_usb_kbd_init function
The patch is that check if usb_get_dev_index() function return valid
pointer. If valid, continue. Otherwise return -1.
Signed-off-by: Ryan Chen <ryan.chen@st.com>
Acked-by: Markus Klotzbuecher <mk@denx.de>
-rw-r--r-- | common/usb_kbd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 108bd60f95..920bb0ffbe 100644 --- a/common/usb_kbd.c +++ b/common/usb_kbd.c @@ -162,6 +162,8 @@ int drv_usb_kbd_init(void) /* scan all USB Devices */ for(i=0;i<USB_MAX_DEVICE;i++) { dev=usb_get_dev_index(i); /* get device */ + if(dev == NULL) + return -1; if(dev->devnum!=-1) { if(usb_kbd_probe(dev,0)==1) { /* Ok, we found a keyboard */ /* check, if it is already registered */ |