public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ryan CHEN <ryan.chen@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Correct drv_usb_kbd_init function
Date: Wed, 20 Aug 2008 13:00:17 -0400	[thread overview]
Message-ID: <1219251617-26166-1-git-send-email-ryan.chen@st.com> (raw)

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>

---
 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 c876495..880e616 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -164,6 +164,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 */
-- 
1.6.0.rc1

             reply	other threads:[~2008-08-20 17:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20 17:00 Ryan CHEN [this message]
2008-09-09 14:35 ` [U-Boot] [PATCH] Correct drv_usb_kbd_init function Markus Klotzbücher
2008-09-09 15:03   ` Wolfgang Denk
2008-09-09 15:03 ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1219251617-26166-1-git-send-email-ryan.chen@st.com \
    --to=ryan.chen@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox