> -----Original Message-----
> From: Bo Shen [mailto:voice.s...@gmail.com]
> Sent: 2015年10月29日 12:02
> To: Yang, Wenyou
> Cc: U-Boot Mailing List; andreas.de...@googlemail.com
> Subject: Re: [PATCH v4] arm: atmel: Add SAMA5D2 Xplained board
> 
> Hi Wenyou,
> 
> On 10/28/2015 13:59 PM, Yang, Wenyou wrote:
> >>> +char *get_cpu_name()
> >>> > >+{
> >>> > >+      unsigned int extension_id = get_extension_chip_id();
> >>> > >+
> >>> > >+      if (cpu_is_sama5d2()) {
> >>> > >+              switch (extension_id) {
> >>> > >+              case ARCH_EXID_SAMA5D21CU:
> >>> > >+                      return "SAMA5D21";
> >>> > >+              case ARCH_EXID_SAMA5D22CU:
> >>> > >+                      return "SAMA5D22-CU";
> >>> > >+              case ARCH_EXID_SAMA5D22CN:
> >>> > >+                      return "SAMA5D22-CN";
> >>> > >+              case ARCH_EXID_SAMA5D23CU:
> >>> > >+                      return "SAMA5D23-CU";
> >>> > >+              case ARCH_EXID_SAMA5D24CX:
> >>> > >+                      return "SAMA5D24-CX";
> >>> > >+              case ARCH_EXID_SAMA5D24CU:
> >>> > >+                      return "SAMA5D24-CU";
> >>> > >+              case ARCH_EXID_SAMA5D26CU:
> >>> > >+                      return "SAMA5D26-CU";
> >>> > >+              case ARCH_EXID_SAMA5D27CU:
> >>> > >+                      return "SAMA5D27-CU";
> >>> > >+              case ARCH_EXID_SAMA5D27CN:
> >>> > >+                      return "SAMA5D27-CN";
> >>> > >+              case ARCH_EXID_SAMA5D28CU:
> >>> > >+                      return "SAMA5D28-CU";
> >>> > >+              case ARCH_EXID_SAMA5D28CN:
> >>> > >+                      return "SAMA5D28-CN";
> >>> > >+              default:
> >>> > >+                      ;
> >>> > >+              }
> >>> > >+      }
> >>> > >+
> >>> > >+      return "Unknown CPU type";
> >>> > >+}
> >> >
> >> >You don't explain why it needs to keep the default option. I think it can 
> >> >be
> removed.
> > Switch-cases should almost always have a default case.
> > The reason to use a default is to 'catch' an unexpected value. It is 
> > necessary for
> this function.
> 
> Yes, as usual, we use default to catch the exceptions. However, here we don't
> need it as the final return is used to catch these exceptions.

Andreas, what is your opinion?


Best Regards,
Wenyou Yang
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to