public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Krzysztof Kozlowski <krzk@kernel.org>, <andrew@lunn.ch>,
	<sebastian.hesselbarth@gmail.com>, <gregory.clement@bootlin.com>,
	<herve.codina@bootlin.com>, <qiang.zhao@nxp.com>,
	<christophe.leroy@csgroup.eu>, <thierry.reding@gmail.com>,
	<jonathanh@nvidia.com>, <nm@ti.com>, <ssantosh@kernel.org>,
	<petlozup@nvidia.com>, <pshete@nvidia.com>,
	<christophe.jaillet@wanadoo.fr>, <ulf.hansson@linaro.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>,
	<linux-tegra@vger.kernel.org>, <jic23@kernel.org>
Subject: Re: [PATCH -next 2/8] soc: fsl: cpm1: Simplify with dev_err_probe()
Date: Wed, 28 Aug 2024 09:58:13 +0800	[thread overview]
Message-ID: <97ff8c02-1a97-7974-06fa-edb35437707d@huawei.com> (raw)
In-Reply-To: <87abe3f1-3cf2-4331-8dde-a422716dd94a@kernel.org>



On 2024/8/27 21:50, Krzysztof Kozlowski wrote:
> On 27/08/2024 13:46, Jinjie Ruan wrote:
>> Use the dev_err_probe() helper to simplify error handling during probe.
>> This also handle scenario, when EDEFER is returned and useless error
>> is printed.
> 
> ? Sorry, this cannot happen. Please point to below code which can defer.
> 

Thank you!

This is not referring to a specific one, but rather the benefits it
offers,simplify code is the main purpose, if necessary, it will be
removed in next version.

>>
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> ---
>>  drivers/soc/fsl/qe/tsa.c | 62 +++++++++++++++-------------------------
>>  1 file changed, 23 insertions(+), 39 deletions(-)
>>
>> diff --git a/drivers/soc/fsl/qe/tsa.c b/drivers/soc/fsl/qe/tsa.c
>> index 7fa399b7a47c..fc37d23b746d 100644
>> --- a/drivers/soc/fsl/qe/tsa.c
>> +++ b/drivers/soc/fsl/qe/tsa.c
>> @@ -453,10 +453,8 @@ static int tsa_of_parse_tdms(struct tsa *tsa, struct device_node *np)
>>  
>>  	for_each_available_child_of_node_scoped(np, tdm_np) {
>>  		ret = of_property_read_u32(tdm_np, "reg", &tdm_id);
>> -		if (ret) {
>> -			dev_err(tsa->dev, "%pOF: failed to read reg\n", tdm_np);
>> -			return ret;
>> -		}
>> +		if (ret)
>> +			return dev_err_probe(tsa->dev, ret, "%pOF: failed to read reg\n", tdm_np);
>>  		switch (tdm_id) {
>>  		case 0:
>>  			tsa->tdms |= BIT(TSA_TDMA);
>> @@ -465,18 +463,15 @@ static int tsa_of_parse_tdms(struct tsa *tsa, struct device_node *np)
>>  			tsa->tdms |= BIT(TSA_TDMB);
>>  			break;
>>  		default:
>> -			dev_err(tsa->dev, "%pOF: Invalid tdm_id (%u)\n", tdm_np,
>> -				tdm_id);
>> -			return -EINVAL;
>> +			return dev_err_probe(tsa->dev, -EINVAL, "%pOF: Invalid tdm_id (%u)\n",
>> +					     tdm_np, tdm_id);
>>  		}
>>  	}
>>  
>>  	for_each_available_child_of_node_scoped(np, tdm_np) {
>>  		ret = of_property_read_u32(tdm_np, "reg", &tdm_id);
>> -		if (ret) {
>> -			dev_err(tsa->dev, "%pOF: failed to read reg\n", tdm_np);
>> -			return ret;
>> -		}
>> +		if (ret)
>> +			return dev_err_probe(tsa->dev, ret, "%pOF: failed to read reg\n", tdm_np);
>>  
>>  		tdm = &tsa->tdm[tdm_id];
>>  		tdm->simode_tdm = TSA_SIMODE_TDM_SDM_NORM;
>> @@ -484,35 +479,26 @@ static int tsa_of_parse_tdms(struct tsa *tsa, struct device_node *np)
>>  		val = 0;
>>  		ret = of_property_read_u32(tdm_np, "fsl,rx-frame-sync-delay-bits",
>>  					   &val);
>> -		if (ret && ret != -EINVAL) {
>> -			dev_err(tsa->dev,
>> -				"%pOF: failed to read fsl,rx-frame-sync-delay-bits\n",
>> -				tdm_np);
>> -			return ret;
>> -		}
>> -		if (val > 3) {
>> -			dev_err(tsa->dev,
>> -				"%pOF: Invalid fsl,rx-frame-sync-delay-bits (%u)\n",
>> -				tdm_np, val);
>> -			return -EINVAL;
>> -		}
>> +		if (ret && ret != -EINVAL)
>> +			return dev_err_probe(tsa->dev, ret,
>> +					     "%pOF: failed to read fsl,rx-frame-sync-delay-bits\n",
>> +					     tdm_np);
>> +		if (val > 3)
>> +			return dev_err_probe(tsa->dev, -EINVAL,
>> +					     "%pOF: Invalid fsl,rx-frame-sync-delay-bits (%u)\n",
>> +					     tdm_np, val);
>>  		tdm->simode_tdm |= TSA_SIMODE_TDM_RFSD(val);
>>  
>>  		val = 0;
>>  		ret = of_property_read_u32(tdm_np, "fsl,tx-frame-sync-delay-bits",
>>  					   &val);
>> -		if (ret && ret != -EINVAL) {
>> -			dev_err(tsa->dev,
>> -				"%pOF: failed to read fsl,tx-frame-sync-delay-bits\n",
>> -				tdm_np);
>> -			return ret;
>> -		}
>> -		if (val > 3) {
>> -			dev_err(tsa->dev,
>> -				"%pOF: Invalid fsl,tx-frame-sync-delay-bits (%u)\n",
>> -				tdm_np, val);
>> -			return -EINVAL;
>> -		}
>> +		if (ret && ret != -EINVAL)
>> +			return dev_err_probe(tsa->dev, ret,
>> +				"%pOF: failed to read fsl,tx-frame-sync-delay-bits\n", tdm_np);
>> +		if (val > 3)
>> +			return dev_err_probe(tsa->dev, -EINVAL,
>> +					     "%pOF: Invalid fsl,tx-frame-sync-delay-bits (%u)\n",
>> +					     tdm_np, val);
>>  		tdm->simode_tdm |= TSA_SIMODE_TDM_TFSD(val);
>>  
>>  		if (of_property_read_bool(tdm_np, "fsl,common-rxtx-pins"))
>> @@ -645,10 +631,8 @@ static int tsa_probe(struct platform_device *pdev)
>>  		return PTR_ERR(tsa->si_regs);
>>  
>>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "si_ram");
>> -	if (!res) {
>> -		dev_err(tsa->dev, "si_ram resource missing\n");
>> -		return -EINVAL;
>> -	}
>> +	if (!res)
>> +		return dev_err_probe(tsa->dev, -EINVAL, "si_ram resource missing\n");
>>  	tsa->si_ram_sz = resource_size(res);
>>  	tsa->si_ram = devm_ioremap_resource(&pdev->dev, res);
>>  	if (IS_ERR(tsa->si_ram))
> 
> Best regards,
> Krzysztof
> 

  reply	other threads:[~2024-08-28  1:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27 11:45 [PATCH -next 0/8] soc: Simplify with scoped for each OF child loop and dev_err_probe() Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 1/8] soc: fsl: cpm1: Simplify with scoped for each OF child loop Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 2/8] soc: fsl: cpm1: Simplify with dev_err_probe() Jinjie Ruan
2024-08-27 13:50   ` Krzysztof Kozlowski
2024-08-28  1:58     ` Jinjie Ruan [this message]
2024-08-28 13:08       ` Krzysztof Kozlowski
2024-08-29  2:25         ` Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 3/8] soc: fsl: cpm1: qmc: Simplify with scoped for each OF child Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 4/8] soc: fsl: cpm1: qmc: Simplify with dev_err_probe() Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 5/8] soc/tegra: pmc: Simplify with scoped for each OF child loop Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 6/8] soc: dove: " Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 7/8] soc: ti: knav_dma: " Jinjie Ruan
2024-08-27 11:46 ` [PATCH -next 8/8] soc: ti: knav_qmss_queue: " Jinjie Ruan
2024-08-29 15:58   ` Kousik Sanagavarapu
2024-08-29 18:06     ` Nishanth Menon
2024-08-30  3:24     ` Jinjie Ruan
2024-08-31 10:30       ` Jonathan Cameron
2024-08-29 15:43 ` (subset) [PATCH -next 0/8] soc: Simplify with scoped for each OF child loop and dev_err_probe() Thierry Reding

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=97ff8c02-1a97-7974-06fa-edb35437707d@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=andrew@lunn.ch \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=christophe.leroy@csgroup.eu \
    --cc=gregory.clement@bootlin.com \
    --cc=herve.codina@bootlin.com \
    --cc=jic23@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nm@ti.com \
    --cc=petlozup@nvidia.com \
    --cc=pshete@nvidia.com \
    --cc=qiang.zhao@nxp.com \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=ssantosh@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=ulf.hansson@linaro.org \
    /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