public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 16/17] clk: Detect failure to set defaults
Date: Mon, 10 May 2021 19:28:57 -0400	[thread overview]
Message-ID: <12dbe672-75fe-c5d4-ca73-2ef72428733a@gmail.com> (raw)
In-Reply-To: <CAPnjgZ3iWSNC+os9QdX1ncL3WwKDLQziabVG4OxoB5qHWB_M9g@mail.gmail.com>

On 5/10/21 12:28 PM, Simon Glass wrote:
> Hi Sean,
> 
> On Sat, 8 May 2021 at 18:40, Sean Anderson <seanga2@gmail.com> wrote:
>>
>> On 5/8/21 6:00 PM, Simon Glass wrote:
>>> When the default clocks cannot be set, the clock is silently probed and
>>> the error is ignored. This is incorrect, since having the clocks at the
>>> correct speed may be important for operation of the system.
>>>
>>> Fix it by checking the return code.
>>>
>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>> ---
>>>
>>>    drivers/clk/clk-uclass.c | 6 +++++-
>>>    1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
>>> index 4ab3c402ed8..2a2e1cfbd61 100644
>>> --- a/drivers/clk/clk-uclass.c
>>> +++ b/drivers/clk/clk-uclass.c
>>> @@ -796,13 +796,17 @@ void devm_clk_put(struct udevice *dev, struct clk *clk)
>>>
>>>    int clk_uclass_post_probe(struct udevice *dev)
>>>    {
>>> +     int ret;
>>> +
>>>        /*
>>>         * when a clock provider is probed. Call clk_set_defaults()
>>>         * also after the device is probed. This takes care of cases
>>>         * where the DT is used to setup default parents and rates
>>>         * using assigned-clocks
>>>         */
>>> -     clk_set_defaults(dev, 1);
>>> +     ret = clk_set_defaults(dev, 1);
>>> +     if (ret)
>>> +             return log_ret(ret);
>>>
>>>        return 0;
>>>    }
>>>
>>
>> See also: https://patchwork.ozlabs.org/project/uboot/patch/20210409021313.433558-2-seanga2 at gmail.com/
> 
> So which should we do? My feeling is that a failure that is
> programmatically silent could cause things to fail, but is there a
> reason why this might be wrong but everything is still OK?

I think both are fine. I think this is definitely a situation where we
should complain loudly so that when things break there is some relevant
output.

--Sean

> 
> Regards,
> Simon
> 
>> Reviewed-by: Sean Anderson <seanga2@gmail.com>

  reply	other threads:[~2021-05-10 23:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08 22:00 [PATCH 00/17] Fix various coverity warnings Simon Glass
2021-05-08 22:00 ` [PATCH 01/17] sandbox: net: Ensure host name is always a valid string Simon Glass
2021-05-09  4:14   ` Ramon Fried
2021-05-08 22:00 ` [PATCH 02/17] video: Check return value in pwm_backlight_of_to_plat() Simon Glass
2021-05-08 22:00 ` [PATCH 03/17] sandbox: Indicate NULL-pointer access in 'sigsegv' command Simon Glass
2021-05-10 13:07   ` Tom Rini
2021-05-08 22:00 ` [PATCH 04/17] test: Rename final check in setexpr_test_backref() Simon Glass
2021-05-08 22:00 ` [PATCH 05/17] tools: Avoid showing return value of clock_gettime() Simon Glass
2021-05-08 22:00 ` [PATCH 06/17] reset: Avoid a warning in devm_reset_bulk_get_by_node() Simon Glass
2021-05-08 22:00 ` [PATCH 07/17] reset: Avoid a warning in devm_regmap_init() Simon Glass
2021-05-10  7:29   ` Pratyush Yadav
2021-05-08 22:00 ` [PATCH 08/17] test: Avoid random numbers in dm_test_devm_regmap() Simon Glass
2021-05-08 22:00 ` [PATCH 09/17] dm: core: Check uclass_get() return value when dumping Simon Glass
2021-05-08 22:00 ` [PATCH 10/17] sandbox: scmi: Indicate dead code for coverity Simon Glass
2021-05-08 22:00 ` [PATCH 11/17] sandbox: cros_ec: Update error handling when reading matrix Simon Glass
2021-05-08 22:00 ` [PATCH 12/17] cbfs: Check offset range when reading a file Simon Glass
2021-05-08 22:00 ` [PATCH 13/17] pinctrl: Avoid coverity warning when checking width Simon Glass
2021-05-08 22:00 ` [PATCH 14/17] tpm: Check outgoing command size Simon Glass
2021-05-08 22:00 ` [PATCH 15/17] sandbox: Silence coverity warning in state_read_file() Simon Glass
2021-05-08 22:00 ` [PATCH 16/17] clk: Detect failure to set defaults Simon Glass
2021-05-09  0:40   ` Sean Anderson
2021-05-10 16:28     ` Simon Glass
2021-05-10 23:28       ` Sean Anderson [this message]
2021-05-08 22:00 ` [PATCH 17/17] RFC: clk: Return error code from clk_set_default_get_by_id() Simon Glass

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=12dbe672-75fe-c5d4-ca73-2ef72428733a@gmail.com \
    --to=seanga2@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