From: Krzysztof Kozlowski <krzk@kernel.org>
To: 于佼良 <yujiaoliang@vivo.com>
Cc: "opensource.kernel" <opensource.kernel@vivo.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] soc: qcom: pbs: Simplify with dev_err_probe()
Date: Fri, 30 Aug 2024 12:57:37 +0200 [thread overview]
Message-ID: <f7b8980b-b5e8-41c3-8e4c-488e06a4ab15@kernel.org> (raw)
In-Reply-To: <5c558e3b-2d65-4045-816a-5e9415d26b8d@vivo.com>
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@vivo.com>
>>> ---
>>> 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
prev parent reply other threads:[~2024-08-30 10:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 12:48 [PATCH v1] soc: qcom: pbs: Simplify with dev_err_probe() Yu Jiaoliang
2024-08-29 23:48 ` Konrad Dybcio
2024-08-30 8:08 ` Krzysztof Kozlowski
2024-08-30 10:03 ` Konrad Dybcio
2024-08-30 15:19 ` Dan Carpenter
2024-08-30 15:31 ` Konrad Dybcio
2024-09-04 18:55 ` Dan Carpenter
2024-09-05 12:35 ` Konrad Dybcio
2024-08-30 10:52 ` 于佼良
2024-08-30 10:57 ` Krzysztof Kozlowski [this message]
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=f7b8980b-b5e8-41c3-8e4c-488e06a4ab15@kernel.org \
--to=krzk@kernel.org \
--cc=andersson@kernel.org \
--cc=konradybcio@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--cc=yujiaoliang@vivo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox