From: Bo Shen <voice.shen@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4] arm: atmel: Add SAMA5D2 Xplained board
Date: Thu, 29 Oct 2015 12:01:57 +0800 [thread overview]
Message-ID: <56319A35.6020906@gmail.com> (raw)
In-Reply-To: <B256D81BAE5131468A838E5D7A243641D6349126@penmbx01>
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.
Best Regards,
Bo Shen
next prev parent reply other threads:[~2015-10-29 4:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-27 9:59 [U-Boot] [PATCH v4] arm: atmel: Add SAMA5D2 Xplained board Wenyou Yang
2015-10-28 3:06 ` Bo Shen
2015-10-28 5:59 ` Yang, Wenyou
2015-10-29 4:01 ` Bo Shen [this message]
2015-10-29 4:28 ` Yang, Wenyou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56319A35.6020906@gmail.com \
--to=voice.shen@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox