All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: Florian Fainelli <f.fainelli@gmail.com>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] soc: bcm: bcm2835-pm: Fix error paths of initialization.
Date: Wed, 20 Feb 2019 10:18:54 -0800	[thread overview]
Message-ID: <87va1e492p.fsf@anholt.net> (raw)
In-Reply-To: <cfe72e6c-4419-9d8a-184b-b0928ab69e11@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2167 bytes --]

Florian Fainelli <f.fainelli@gmail.com> writes:

> On 2/13/19 2:33 PM, Stefan Wahren wrote:
>> 
>>> Eric Anholt <eric@anholt.net> hat am 13. Februar 2019 um 19:28 geschrieben:
>>>
>>>
>>> Stefan Wahren <stefan.wahren@i2se.com> writes:
>>>
>>>> Hi Eric,
>>>>
>>>> Am 13.02.19 um 01:33 schrieb Eric Anholt:
>>>>> The clock driver may probe after ours and so we need to pass the
>>>>> -EPROBE_DEFER out.  Fix the other error path while we're here.
>>>>>
>>>>> Signed-off-by: Eric Anholt <eric@anholt.net>
>>>>> Fixes: 670c672608a1 ("soc: bcm: bcm2835-pm: Add support for power domains under a new binding.")
>>>>> ---
>>>>>  drivers/soc/bcm/bcm2835-power.c | 30 +++++++++++++++++++++++++-----
>>>>>  1 file changed, 25 insertions(+), 5 deletions(-)
>>>>>
>>>>> diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c
>>>>> index 4a1b99b773c0..11f9469423f7 100644
>>>>> --- a/drivers/soc/bcm/bcm2835-power.c
>>>>> +++ b/drivers/soc/bcm/bcm2835-power.c
>>>>> @@ -485,7 +485,7 @@ static int bcm2835_power_pd_power_off(struct generic_pm_domain *domain)
>>>>>  	}
>>>>>  }
>>>>>  
>>>>> -static void
>>>>> +static int
>>>>>  bcm2835_init_power_domain(struct bcm2835_power *power,
>>>>>  			  int pd_xlate_index, const char *name)
>>>>>  {
>>>>> @@ -493,6 +493,12 @@ bcm2835_init_power_domain(struct bcm2835_power *power,
>>>>>  	struct bcm2835_power_domain *dom = &power->domains[pd_xlate_index];
>>>>>  
>>>>>  	dom->clk = devm_clk_get(dev->parent, name);
>>>>> +	if (IS_ERR(dom->clk)) {
>>>>> +		int ret = PTR_ERR(dom->clk);
>>>>> +
>>>>> +		if (ret == -EPROBE_DEFER)
>>>>> +			return ret;
>>>> is it safe to proceed in the other error cases?
>>>> Even it would be more consistent with clk_prepare_enable() to print an
>>>> error here.
>>>
>>> Yes, not all domains have a clk, so we want to ignore the other error.
>> 
>> But shouldn't we set dom->clk to NULL instead of keeping the error
>> pointer? AFAIK clk_prepare_enable is aware of NULL instead of error
>> pointer.
>
> If the clock is really optional, then yes, this should be the way to go.

Sigh, error pointers.  Fixed, sending a v2.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Eric Anholt <eric@anholt.net>
To: Florian Fainelli <f.fainelli@gmail.com>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH 2/2] soc: bcm: bcm2835-pm: Fix error paths of initialization.
Date: Wed, 20 Feb 2019 10:18:54 -0800	[thread overview]
Message-ID: <87va1e492p.fsf@anholt.net> (raw)
In-Reply-To: <cfe72e6c-4419-9d8a-184b-b0928ab69e11@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2167 bytes --]

Florian Fainelli <f.fainelli@gmail.com> writes:

> On 2/13/19 2:33 PM, Stefan Wahren wrote:
>> 
>>> Eric Anholt <eric@anholt.net> hat am 13. Februar 2019 um 19:28 geschrieben:
>>>
>>>
>>> Stefan Wahren <stefan.wahren@i2se.com> writes:
>>>
>>>> Hi Eric,
>>>>
>>>> Am 13.02.19 um 01:33 schrieb Eric Anholt:
>>>>> The clock driver may probe after ours and so we need to pass the
>>>>> -EPROBE_DEFER out.  Fix the other error path while we're here.
>>>>>
>>>>> Signed-off-by: Eric Anholt <eric@anholt.net>
>>>>> Fixes: 670c672608a1 ("soc: bcm: bcm2835-pm: Add support for power domains under a new binding.")
>>>>> ---
>>>>>  drivers/soc/bcm/bcm2835-power.c | 30 +++++++++++++++++++++++++-----
>>>>>  1 file changed, 25 insertions(+), 5 deletions(-)
>>>>>
>>>>> diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c
>>>>> index 4a1b99b773c0..11f9469423f7 100644
>>>>> --- a/drivers/soc/bcm/bcm2835-power.c
>>>>> +++ b/drivers/soc/bcm/bcm2835-power.c
>>>>> @@ -485,7 +485,7 @@ static int bcm2835_power_pd_power_off(struct generic_pm_domain *domain)
>>>>>  	}
>>>>>  }
>>>>>  
>>>>> -static void
>>>>> +static int
>>>>>  bcm2835_init_power_domain(struct bcm2835_power *power,
>>>>>  			  int pd_xlate_index, const char *name)
>>>>>  {
>>>>> @@ -493,6 +493,12 @@ bcm2835_init_power_domain(struct bcm2835_power *power,
>>>>>  	struct bcm2835_power_domain *dom = &power->domains[pd_xlate_index];
>>>>>  
>>>>>  	dom->clk = devm_clk_get(dev->parent, name);
>>>>> +	if (IS_ERR(dom->clk)) {
>>>>> +		int ret = PTR_ERR(dom->clk);
>>>>> +
>>>>> +		if (ret == -EPROBE_DEFER)
>>>>> +			return ret;
>>>> is it safe to proceed in the other error cases?
>>>> Even it would be more consistent with clk_prepare_enable() to print an
>>>> error here.
>>>
>>> Yes, not all domains have a clk, so we want to ignore the other error.
>> 
>> But shouldn't we set dom->clk to NULL instead of keeping the error
>> pointer? AFAIK clk_prepare_enable is aware of NULL instead of error
>> pointer.
>
> If the clock is really optional, then yes, this should be the way to go.

Sigh, error pointers.  Fixed, sending a v2.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2019-02-20 18:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13  0:33 [PATCH 1/2] soc: bcm: bcm2835-pm: Fix PM_IMAGE_PERI power domain support Eric Anholt
2019-02-13  0:33 ` Eric Anholt
2019-02-13  0:33 ` [PATCH 2/2] soc: bcm: bcm2835-pm: Fix error paths of initialization Eric Anholt
2019-02-13  0:33   ` Eric Anholt
2019-02-13  8:46   ` Stefan Wahren
2019-02-13  8:46     ` Stefan Wahren
2019-02-13 18:28     ` Eric Anholt
2019-02-13 18:28       ` Eric Anholt
2019-02-13 22:33       ` Stefan Wahren
2019-02-13 22:33         ` Stefan Wahren
2019-02-15 19:29         ` Florian Fainelli
2019-02-15 19:29           ` Florian Fainelli
2019-02-20 18:18           ` Eric Anholt [this message]
2019-02-20 18:18             ` Eric Anholt

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=87va1e492p.fsf@anholt.net \
    --to=eric@anholt.net \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=stefan.wahren@i2se.com \
    /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.