Skip to contentSkip to conversation

API: Correct storage enumeration routine, other minor fixes in API storage area.

PATCH New Rafal Jaworowski 2 participants 2 messages Jul 28, 2008 – Jul 29, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 API: Correct storage enumeration routine, other minor fixes in API storage area.

---
 api/api_storage.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
api/api_storage.c +11 -5
index 7e63240..874c538 100644
@@ -1,5 +1,5 @@
 /*
- * (C) Copyright 2007 Semihalf
+ * (C) Copyright 2007-2008 Semihalf
  *
  * Written by: Rafal Jaworowski <[email protected]>
  *
@@ -53,7 +53,7 @@ struct stor_spec {
 	int		enum_started;
 	int		enum_ended;
 	int		type;		/* "external" type: DT_STOR_{IDE,USB,etc} */
-	char		name[4];
+	char		*name;
 };
 
 static struct stor_spec specs[ENUM_MAX] = { { 0, 0, 0, 0, "" }, };
@@ -108,7 +108,10 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
 
 	if (first) {
 		di->cookie = (void *)get_dev(specs[type].name, 0);
-		found = 1;
+		if (di->cookie == NULL)
+			return 0;
+		else
+			found = 1;
 
 	} else {
 		for (i = 0; i < specs[type].max_dev; i++)
@@ -123,7 +126,10 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
 				}
 
 				di->cookie = (void *)get_dev(specs[type].name, i);
-				found = 1;
+				if (di->cookie == NULL)
+					return 0;
+				else
+					found = 1;
 
 				/* provide hint if there are more devices in
 				 * this group to enumerate */
@@ -360,7 +366,7 @@ lbasize_t dev_read_stor(void *cookie, void *buf, lbasize_t len, lbastart_t start
 		return 0;
 
 	if ((dd->block_read) == NULL) {
-		debugf("no block_read() for device 0x%08x\n");
+		debugf("no block_read() for device 0x%08x\n", cookie);
 		return 0;
 	}
 
Signature · 1 line
1.5.2.2
#1 lore raw

PATCH 1/1 API: Correct storage enumeration routine, other minor fixes in API storage area.

Quoted 5 lines · In message <[email protected]> you wrote:
---
 api/api_storage.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The computer can't tell you the emotional story. It can give you  the
exact mathematical design, but what's missing is the eyebrows.
- Frank Zappa