From: Eric Nelson <eric.nelson@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] i.MX6: mx6q_sabrelite: add SATA bindings
Date: Mon, 26 Mar 2012 09:59:08 -0700 [thread overview]
Message-ID: <4F70A05C.7020004@boundarydevices.com> (raw)
In-Reply-To: <4F70725F.8080105@denx.de>
On 03/26/2012 06:42 AM, Stefano Babic wrote:
> On 26/03/2012 15:35, Eric Nelson wrote:
>> On 03/26/2012 01:35 AM, Stefano Babic wrote:
>>> On 26/03/2012 01:00, Eric Nelson wrote:
>>>> V2 has been stripped of the board-independent changes and
>>>>
>>>> <snip>
>>>>
>>>> +#ifdef CONFIG_CMD_SATA
>>>> +
>>>> +int setup_sata(void)
>>>> +{
>>>> + int rval = enable_sata_clock();
>>>
>>> What about to return at this point if there is an error ?
>>>
>> I'm not sure I understand. Do you mean re-structure the code with
>> two returns like this?
>
> No, much easier - I find the code is easy to understand if it looks like
> if the function returns immediately in case of error.
>
> if (do_something())
> return ERROR;
>
> < code when no error happens>
>
> Your enable_sata_clock() return only -1 in case of error. You could
> easy write:
>
> if (enable_sata_clock())
> return -1 (or better a value in errno.h)
>
The choice of error code is better made inside enable_sata_clock(),
although I'm not really sure what error code to choose.
The error occurs if the PLL fails to lock and would indicate that
something's horribly wrong.
I'm guessing -EIO is probably the right choice.
If you agree, I'll send V2 of "i.MX6: add enable_sata_clock()" and
V3 of "i.MX6: mx6q_sabrelite: add SATA bindings".
Please advise,
Eric
next prev parent reply other threads:[~2012-03-26 16:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <http://lists.denx.de/pipermail/u-boot/2012-March/120899.html>
2012-03-25 23:00 ` [U-Boot] (no subject) Eric Nelson
2012-03-25 23:00 ` [U-Boot] [PATCH 1/2] i.MX6: add enable_sata_clock() Eric Nelson
2012-03-25 23:00 ` [U-Boot] [PATCH 2/2] i.MX6: mx6q_sabrelite: add SATA bindings Eric Nelson
2012-03-26 8:35 ` Stefano Babic
2012-03-26 13:35 ` Eric Nelson
2012-03-26 13:42 ` Stefano Babic
2012-03-26 16:59 ` Eric Nelson [this message]
2012-04-25 23:12 ` Eric Nelson
2012-03-25 23:10 ` [U-Boot] [PATCH V3 0/2] " Eric Nelson
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=4F70A05C.7020004@boundarydevices.com \
--to=eric.nelson@boundarydevices.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.