From a17c548b5393c5e0b457d6e3043a85bde717f532 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Mon, 19 Jul 2010 11:36:56 +0200 Subject: [PATCH] usb_storage.c: initialize device type The device type was left uninitialized which caused later tests against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would attempt to print information about non-existent devices like this: => usb part print_part of 0 Partition Map for USB device 0 -- Partition Type: DOS Partition Start Sector Num Sectors Type 1 0 2031616 f8 print_part of 1 ## Unknown partition table print_part of 2 ## Unknown partition table print_part of 3 ## Unknown partition table print_part of 4 ## Unknown partition table => By initializing the type as DEV_TYPE_UNKNOWN we avoid all the "Unknown partition table" messages. [Note: the "print_part of ?" messages is left over debug code that will be removed in another patch.] Signed-off-by: Wolfgang Denk Cc: Remy Bohmer --- common/usb_storage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/usb_storage.c b/common/usb_storage.c index 4fc01a2..9f31265 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -224,10 +224,11 @@ int usb_stor_scan(int mode) for (i = 0; i < USB_MAX_STOR_DEV; i++) { memset(&usb_dev_desc[i], 0, sizeof(block_dev_desc_t)); - usb_dev_desc[i].target = 0xff; usb_dev_desc[i].if_type = IF_TYPE_USB; usb_dev_desc[i].dev = i; usb_dev_desc[i].part_type = PART_TYPE_UNKNOWN; + usb_dev_desc[i].target = 0xff; + usb_dev_desc[i].type = DEV_TYPE_UNKNOWN; usb_dev_desc[i].block_read = usb_stor_read; usb_dev_desc[i].block_write = usb_stor_write; } -- 2.7.4