Re: [PATCH v1] soc: qcom: pbs: Simplify with dev_err_probe()

From: Konrad Dybcio
Date: Fri Aug 30 2024 - 06:03:31 EST


On 30.08.2024 10:08 AM, Krzysztof Kozlowski wrote:
> On 29/08/2024 14:48, Yu Jiaoliang wrote:
>> Error handling in probe() can be a bit simpler with dev_err_probe().
>>
>> Signed-off-by: Yu Jiaoliang <yujiaoliang@xxxxxxxx>
>> ---
>> drivers/soc/qcom/qcom-pbs.c | 7 +++----
>> 1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/soc/qcom/qcom-pbs.c b/drivers/soc/qcom/qcom-pbs.c
>> index 77a70d3d0d0b..ab9de12ec901 100644
>> --- a/drivers/soc/qcom/qcom-pbs.c
>> +++ b/drivers/soc/qcom/qcom-pbs.c
>> @@ -201,10 +201,9 @@ static int qcom_pbs_probe(struct platform_device *pdev)
>> }
>>
>> ret = device_property_read_u32(pbs->dev, "reg", &val);
>> - if (ret < 0) {
>> - dev_err(pbs->dev, "Couldn't find reg, ret = %d\n", ret);
>> - return ret;
>> - }
>> + if (ret < 0)
>> + return dev_err_probe(pbs->dev, ret, "Couldn't find reg\n");
>
> This cannot defer, so not much benefits. And you ignore other place in
> the probe()... That's like a weird pattern with all your patches change
> something irrelevant, but leave other places unchanged.
>
> That's pointless and churn.

Hm, that's a good point.. Maybe the static checker folks could come up
with a way that would find functions that call something that can defer
at one point or another and suggest (not) using dev_err_probe with W=1/2..
(although that is probably not going to be very high prio given all the
other static checker issues we're still yet to resolve)

Unless we have something like that already? +CC Dan

Konrad