[PATCH] mmc: meson-mx-sdhc: use PTR_ERR_OR_ZERO() to simplify code

Xichao Zhao posted 1 patch 1 month, 3 weeks ago
drivers/mmc/host/meson-mx-sdhc-clkc.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] mmc: meson-mx-sdhc: use PTR_ERR_OR_ZERO() to simplify code
Posted by Xichao Zhao 1 month, 3 weeks ago
Use the standard error pointer macro to shorten the code and simplify.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 drivers/mmc/host/meson-mx-sdhc-clkc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c
index cbd17a596cd2..6d619bd0a8dc 100644
--- a/drivers/mmc/host/meson-mx-sdhc-clkc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c
@@ -84,10 +84,8 @@ static int meson_mx_sdhc_gate_clk_hw_register(struct device *dev,
 		return ret;
 
 	clk_bulk_data[bulk_index].clk = devm_clk_hw_get_clk(dev, hw, name_suffix);
-	if (IS_ERR(clk_bulk_data[bulk_index].clk))
-		return PTR_ERR(clk_bulk_data[bulk_index].clk);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(clk_bulk_data[bulk_index].clk);
 }
 
 int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base,
-- 
2.34.1
Re: [PATCH] mmc: meson-mx-sdhc: use PTR_ERR_OR_ZERO() to simplify code
Posted by Ulf Hansson 1 month, 2 weeks ago
On Tue, 12 Aug 2025 at 11:29, Xichao Zhao <zhao.xichao@vivo.com> wrote:
>
> Use the standard error pointer macro to shorten the code and simplify.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/meson-mx-sdhc-clkc.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c
> index cbd17a596cd2..6d619bd0a8dc 100644
> --- a/drivers/mmc/host/meson-mx-sdhc-clkc.c
> +++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c
> @@ -84,10 +84,8 @@ static int meson_mx_sdhc_gate_clk_hw_register(struct device *dev,
>                 return ret;
>
>         clk_bulk_data[bulk_index].clk = devm_clk_hw_get_clk(dev, hw, name_suffix);
> -       if (IS_ERR(clk_bulk_data[bulk_index].clk))
> -               return PTR_ERR(clk_bulk_data[bulk_index].clk);
>
> -       return 0;
> +       return PTR_ERR_OR_ZERO(clk_bulk_data[bulk_index].clk);
>  }
>
>  int meson_mx_sdhc_register_clkc(struct device *dev, void __iomem *base,
> --
> 2.34.1
>
Re: [PATCH] mmc: meson-mx-sdhc: use PTR_ERR_OR_ZERO() to simplify code
Posted by Martin Blumenstingl 1 month, 3 weeks ago
On Tue, Aug 12, 2025 at 11:29 AM Xichao Zhao <zhao.xichao@vivo.com> wrote:
>
> Use the standard error pointer macro to shorten the code and simplify.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>