diff mbox series

[4/7] memory: pl172: simplify with dev_err_probe()

Message ID 20240823-b4-cleanup-h-guard-v1-4-01668915bd55@linaro.org (mailing list archive)
State New, archived
Headers show
Series memory: simplify with devm() and guard() | expand

Commit Message

Krzysztof Kozlowski Aug. 23, 2024, 10:15 a.m. UTC
Use dev_err_probe() to avoid dmesg flood on actual defer.  This makes
the code also simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/memory/pl172.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Jonathan Cameron Aug. 23, 2024, 11:46 a.m. UTC | #1
On Fri, 23 Aug 2024 12:15:59 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> Use dev_err_probe() to avoid dmesg flood on actual defer.  This makes
> the code also simpler.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
FWIW
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huwei.com>
> ---
>  drivers/memory/pl172.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/memory/pl172.c b/drivers/memory/pl172.c
> index 9eb8cc7de494..390012401f64 100644
> --- a/drivers/memory/pl172.c
> +++ b/drivers/memory/pl172.c
> @@ -217,10 +217,9 @@ static int pl172_probe(struct amba_device *adev, const struct amba_id *id)
>  		return -ENOMEM;
>  
>  	pl172->clk = devm_clk_get(dev, "mpmcclk");
> -	if (IS_ERR(pl172->clk)) {
> -		dev_err(dev, "no mpmcclk provided clock\n");
> -		return PTR_ERR(pl172->clk);
> -	}
> +	if (IS_ERR(pl172->clk))
> +		return dev_err_probe(dev, PTR_ERR(pl172->clk),
> +				     "no mpmcclk provided clock\n");
>  
>  	ret = clk_prepare_enable(pl172->clk);
>  	if (ret) {
>
Vladimir Zapolskiy Aug. 23, 2024, 12:22 p.m. UTC | #2
On 8/23/24 13:15, Krzysztof Kozlowski wrote:
> Use dev_err_probe() to avoid dmesg flood on actual defer.  This makes
> the code also simpler.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>

--
Best wishes,
Vladimir
diff mbox series

Patch

diff --git a/drivers/memory/pl172.c b/drivers/memory/pl172.c
index 9eb8cc7de494..390012401f64 100644
--- a/drivers/memory/pl172.c
+++ b/drivers/memory/pl172.c
@@ -217,10 +217,9 @@  static int pl172_probe(struct amba_device *adev, const struct amba_id *id)
 		return -ENOMEM;
 
 	pl172->clk = devm_clk_get(dev, "mpmcclk");
-	if (IS_ERR(pl172->clk)) {
-		dev_err(dev, "no mpmcclk provided clock\n");
-		return PTR_ERR(pl172->clk);
-	}
+	if (IS_ERR(pl172->clk))
+		return dev_err_probe(dev, PTR_ERR(pl172->clk),
+				     "no mpmcclk provided clock\n");
 
 	ret = clk_prepare_enable(pl172->clk);
 	if (ret) {