Commit af75a45d23b72a59ac5cc0427696c7f634fdc94b

Authored by Wolfgang Denk
1 parent c21f62d848

IDE: bail out of dev_print() for unknown device types

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>

Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff

... ... @@ -114,6 +114,11 @@
114 114 lbaint_t lba512;
115 115 #endif
116 116  
  117 + if (dev_desc->type == DEV_TYPE_UNKNOWN) {
  118 + puts ("not available\n");
  119 + return;
  120 + }
  121 +
117 122 switch (dev_desc->if_type) {
118 123 case IF_TYPE_SCSI:
119 124 printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n",