* [PATCH v1] rtc: rtc-asm9260: Switch to use dev_err_probe()
@ 2024-08-28 12:25 Yang Ruibin
2024-08-28 12:35 ` Alexander Dahl
2024-08-28 12:37 ` Krzysztof Kozlowski
0 siblings, 2 replies; 3+ messages in thread
From: Yang Ruibin @ 2024-08-28 12:25 UTC (permalink / raw)
To: Krzysztof Kozlowski, Alexandre Belloni, linux-arm-kernel,
linux-rtc, linux-kernel
Cc: opensource.kernel, Yang Ruibin
use dev_err_probe() instead of dev_err() to simplify the error path and
standardize the format of the error code.
Signed-off-by: Yang Ruibin <11162571@vivo.com>
---
drivers/rtc/rtc-asm9260.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-asm9260.c b/drivers/rtc/rtc-asm9260.c
index a83b47e0d..2b7058ebb 100644
--- a/drivers/rtc/rtc-asm9260.c
+++ b/drivers/rtc/rtc-asm9260.c
@@ -268,10 +268,8 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
return PTR_ERR(priv->clk);
ret = clk_prepare_enable(priv->clk);
- if (ret) {
- dev_err(dev, "Failed to enable clk!\n");
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to prepare clk!\n");
ccr = ioread32(priv->iobase + HW_CCR);
/* if dev is not enabled, reset it */
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] rtc: rtc-asm9260: Switch to use dev_err_probe()
2024-08-28 12:25 [PATCH v1] rtc: rtc-asm9260: Switch to use dev_err_probe() Yang Ruibin
@ 2024-08-28 12:35 ` Alexander Dahl
2024-08-28 12:37 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Dahl @ 2024-08-28 12:35 UTC (permalink / raw)
To: Yang Ruibin
Cc: Krzysztof Kozlowski, Alexandre Belloni, linux-arm-kernel,
linux-rtc, linux-kernel, opensource.kernel
Hello,
Am Wed, Aug 28, 2024 at 08:25:07PM +0800 schrieb Yang Ruibin:
> use dev_err_probe() instead of dev_err() to simplify the error path and
> standardize the format of the error code.
>
> Signed-off-by: Yang Ruibin <11162571@vivo.com>
> ---
> drivers/rtc/rtc-asm9260.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/rtc/rtc-asm9260.c b/drivers/rtc/rtc-asm9260.c
> index a83b47e0d..2b7058ebb 100644
> --- a/drivers/rtc/rtc-asm9260.c
> +++ b/drivers/rtc/rtc-asm9260.c
> @@ -268,10 +268,8 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
> return PTR_ERR(priv->clk);
>
> ret = clk_prepare_enable(priv->clk);
> - if (ret) {
> - dev_err(dev, "Failed to enable clk!\n");
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to prepare clk!\n");
This changes the error message from "failed to enable" to "failed to
prepare", which is not what the commit message says. However
technically clk_prepare_enable() does both, so maybe a different text
would match better?
Greets
Alex
>
> ccr = ioread32(priv->iobase + HW_CCR);
> /* if dev is not enabled, reset it */
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] rtc: rtc-asm9260: Switch to use dev_err_probe()
2024-08-28 12:25 [PATCH v1] rtc: rtc-asm9260: Switch to use dev_err_probe() Yang Ruibin
2024-08-28 12:35 ` Alexander Dahl
@ 2024-08-28 12:37 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-28 12:37 UTC (permalink / raw)
To: Yang Ruibin, Alexandre Belloni, linux-arm-kernel, linux-rtc,
linux-kernel
Cc: opensource.kernel
On 28/08/2024 14:25, Yang Ruibin wrote:
> use dev_err_probe() instead of dev_err() to simplify the error path and
> standardize the format of the error code.
>
> Signed-off-by: Yang Ruibin <11162571@vivo.com>
> ---
> drivers/rtc/rtc-asm9260.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/rtc/rtc-asm9260.c b/drivers/rtc/rtc-asm9260.c
> index a83b47e0d..2b7058ebb 100644
> --- a/drivers/rtc/rtc-asm9260.c
> +++ b/drivers/rtc/rtc-asm9260.c
> @@ -268,10 +268,8 @@ static int asm9260_rtc_probe(struct platform_device *pdev)
> return PTR_ERR(priv->clk);
>
> ret = clk_prepare_enable(priv->clk);
> - if (ret) {
> - dev_err(dev, "Failed to enable clk!\n");
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to prepare clk!\n");
>
There is little simplification here, plus this cannot really defer. I
think it would be fine as part of other cleanups but as standalone
single patch I see no benefits of this.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-28 12:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28 12:25 [PATCH v1] rtc: rtc-asm9260: Switch to use dev_err_probe() Yang Ruibin
2024-08-28 12:35 ` Alexander Dahl
2024-08-28 12:37 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox