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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30/08/2024 12:52, 于佼良 wrote:
> On 2024/8/30 16:08, 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");
> Thank you for the feedback. I apologize for the oversight.
>> This cannot defer, so not much benefits.
> As noted in the dev_err_probe documentation, using this helper offers 
> benefits like standardized error code formatting and more compact error 
> paths.
> 
> "Using this helper in your probe function is totally fine even if @err  
> known to nerver be -EPROBE_DEFER. The benefit compared to a normal 
> dev_err() is the standardized format of the error code, it being emitted 
> syumbolically (i.e. you get "EAGAIN" instead of "-35") and the fact that 
> the error code is returned which allows more compact error paths."

I know, I wrote a bit of patches for the kernel myself...

It's still for me little benefit.


>> 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.
> If you think it's OK, I will update the patch to include both 
> modifications in the probe() function. I plan to submit patch v2 with 
> these changes and hope it will be more acceptable.

Doing this one-by-one is churn. For me that's not correct.

Changing this everywhere in the driver is questionable/subjective: some
find it ok, some not (considering this cannot defer).

But, after looking at your other patches like this (see serial), I have
doubts you know what you are doing in general. And that's the real
problem. You send innocent patch which requires a serious review,
because you do not understand the code.

Please get a mentor which will guide you through this. Or do some more
impactful changes like fixing warnings.

Best regards,
Krzysztof





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux