public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] pmdomain: bcm: Convert to use dev_err_probe()
@ 2024-08-30 11:32 Shen Lichuan
  2024-08-30 18:13 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 2+ messages in thread
From: Shen Lichuan @ 2024-08-30 11:32 UTC (permalink / raw)
  To: rafal, florian.fainelli, ulf.hansson
  Cc: bcm-kernel-feedback-list, linux-pm, linux-kernel,
	opensource.kernel, Shen Lichuan

Use dev_err_probe() to simplify the error path and unify a message
template.

Using this helper is totally fine even if err is known to never
be -EPROBE_DEFER.

The benefit compared to a normal dev_err() is the standardized format
of the error code, it being emitted symbolically and the fact that
the error code is returned which allows more compact error paths.

Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
---
 drivers/pmdomain/bcm/bcm-pmb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pmdomain/bcm/bcm-pmb.c b/drivers/pmdomain/bcm/bcm-pmb.c
index a72ba26ecf9d..ffd08f13d9ef 100644
--- a/drivers/pmdomain/bcm/bcm-pmb.c
+++ b/drivers/pmdomain/bcm/bcm-pmb.c
@@ -325,10 +325,8 @@ static int bcm_pmb_probe(struct platform_device *pdev)
 	}
 
 	err = of_genpd_add_provider_onecell(dev->of_node, &pmb->genpd_onecell_data);
-	if (err) {
-		dev_err(dev, "failed to add genpd provider: %d\n", err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(dev, err, "failed to add genpd provider\n");
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] pmdomain: bcm: Convert to use dev_err_probe()
  2024-08-30 11:32 [PATCH v1] pmdomain: bcm: Convert to use dev_err_probe() Shen Lichuan
@ 2024-08-30 18:13 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-30 18:13 UTC (permalink / raw)
  To: ulf.hansson
  Cc: florian.fainelli, Shen Lichuan, bcm-kernel-feedback-list,
	linux-pm, linux-kernel, opensource.kernel, rafal

On 30/08/2024 13:32, Shen Lichuan wrote:
> Use dev_err_probe() to simplify the error path and unify a message
> template.
> 
> Using this helper is totally fine even if err is known to never
> be -EPROBE_DEFER.
> 
> The benefit compared to a normal dev_err() is the standardized format
> of the error code, it being emitted symbolically and the fact that
> the error code is returned which allows more compact error paths.
> 
> Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
> ---
>  drivers/pmdomain/bcm/bcm-pmb.c | 6 ++----

Ulf,

Since ~2 weeks there is tremendous amount of trivial patches coming from
vivo.com. I identified at least 6 buggy, where the contributor did not
understand the code. Not sure about intention, but I advise extra
carefulness when dealing with these "trivial" improvements (because we
tend to apply things which look trivial).

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-30 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-30 11:32 [PATCH v1] pmdomain: bcm: Convert to use dev_err_probe() Shen Lichuan
2024-08-30 18:13 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox