From e84dddf10a7d1b3e9a65113fb0387d789ecf1dbf Mon Sep 17 00:00:00 2001 From: Paul Barker Date: Mon, 16 Oct 2023 10:25:37 +0100 Subject: [PATCH] mmc: renesas-sdhi: Refactor probe function Move the assignment of priv->quirks earlier in the function. This allows us to drop the quirks local variable and makes it easier to maintain clean error handling when we add RZ/G2L support in the next patch. Signed-off-by: Paul Barker Reviewed-by: Marek Vasut --- drivers/mmc/renesas-sdhi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c index 8e716f7449..1536c97820 100644 --- a/drivers/mmc/renesas-sdhi.c +++ b/drivers/mmc/renesas-sdhi.c @@ -961,14 +961,14 @@ static void renesas_sdhi_filter_caps(struct udevice *dev) static int renesas_sdhi_probe(struct udevice *dev) { struct tmio_sd_priv *priv = dev_get_priv(dev); - u32 quirks = dev_get_driver_data(dev); struct fdt_resource reg_res; DECLARE_GLOBAL_DATA_PTR; int ret; priv->clk_get_rate = renesas_sdhi_clk_get_rate; - if (quirks == RENESAS_GEN2_QUIRKS) { + priv->quirks = dev_get_driver_data(dev); + if (priv->quirks == RENESAS_GEN2_QUIRKS) { ret = fdt_get_resource(gd->fdt_blob, dev_of_offset(dev), "reg", 0, ®_res); if (ret < 0) { @@ -978,7 +978,7 @@ static int renesas_sdhi_probe(struct udevice *dev) } if (fdt_resource_size(®_res) == 0x100) - quirks |= TMIO_SD_CAP_16BIT; + priv->quirks |= TMIO_SD_CAP_16BIT; } ret = clk_get_by_index(dev, 0, &priv->clk); @@ -1012,8 +1012,7 @@ static int renesas_sdhi_probe(struct udevice *dev) goto err_clkh; } - priv->quirks = quirks; - ret = tmio_sd_probe(dev, quirks); + ret = tmio_sd_probe(dev, priv->quirks); if (ret) goto err_tmio_probe; -- 2.39.5