Subject: Re: [PATCH 3/3] pwm: bcm2835: suppress error message during deferred probe

From: Stefan Wahren <[email-masked]>
Date: Sat, 24 Aug 2019 11:44:10 +0200

Am 24.08.19 um 11:30 schrieb Uwe Kleine-König:
> On Sat, Aug 24, 2019 at 09:07:25AM +0200, Stefan Wahren wrote:
>> This suppresses error messages in case the PWM clock isn't ready yet.
>>
>> Signed-off-by: Stefan Wahren <[email-masked]>
>> ---
>>  drivers/pwm/pwm-bcm2835.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c
>> index 2c82386..ce362be 100644
>> --- a/drivers/pwm/pwm-bcm2835.c
>> +++ b/drivers/pwm/pwm-bcm2835.c
>> @@ -153,7 +153,10 @@ static int bcm2835_pwm_probe(struct platform_device *pdev)
>>
>>  	pc->clk = devm_clk_get(&pdev->dev, NULL);
>>  	if (IS_ERR(pc->clk)) {
>> -		dev_err(&pdev->dev, "clock not found: %ld\n", PTR_ERR(pc->clk));
>> +		if (PTR_ERR(pc->clk) != -EPROBE_DEFER) {
>> +			dev_err(&pdev->dev, "clock not found: %ld\n",
>> +				PTR_ERR(pc->clk));
>> +		}
>>  		return PTR_ERR(pc->clk);
>>  	}
> I would have used:
>
> 	if (IS_ERR(pc->clk)) {
> 		int err = PTR_ERR(pc->clk);
> 		if (err != -EPROBE_DEFER)
> 			dev_err(&pdev->dev, "clock not found: %d\n", err);
>
> 		return err;
> 	}
>
> This calculates the error code only once and make the dev_err line short
> enough to not make it necessary to add a line break.
Sure that's better. Will send V2 soon
> Best regards
> Uwe

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel