IDE: bail out of dev_print() for unknown device types
authorWolfgang Denk <wd@denx.de>
Fri, 15 May 2009 07:27:58 +0000 (09:27 +0200)
committerWolfgang Denk <wd@denx.de>
Fri, 15 May 2009 20:30:13 +0000 (22:30 +0200)
Commit 574b319512 introduced a subtle bug by mixing a list of tests
for "dev_desc->type" and "dev_desc->if_type" into one switch(), which
then mostly did not work because "dev_desc->type" cannot take any
"IF_*" type values. A later fix in commit 8ec6e332ea changed the
switch() into testing "dev_desc->if_type", but at this point the
initial test for unknown device types was completely lost, which
resulted in output like that for IDE ports without device attached:

  Device 1: Model:  Firm:  Ser#:
            Type: # 1F #
            Capacity: not available

This patch re-introduces the missing test for unknown device types.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
disk/part.c

index c7774930b8499d2d1f3d83b17484cccddc25b404..b92fb45b8616c79ed0de0350d45a6bbb8a292729 100644 (file)
@@ -114,6 +114,11 @@ void dev_print (block_dev_desc_t *dev_desc)
        lbaint_t lba512;
 #endif
 
+       if (dev_desc->type == DEV_TYPE_UNKNOWN) {
+               puts ("not available\n");
+               return;
+       }
+
        switch (dev_desc->if_type) {
        case IF_TYPE_SCSI:
                printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n",