]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: renesas-sdhi: Refactor probe function
authorPaul Barker <paul.barker.ct@bp.renesas.com>
Mon, 16 Oct 2023 09:25:37 +0000 (10:25 +0100)
committerMarek Vasut <marek.vasut+renesas@mailbox.org>
Tue, 17 Oct 2023 01:27:42 +0000 (03:27 +0200)
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 <paul.barker.ct@bp.renesas.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
drivers/mmc/renesas-sdhi.c

index 8e716f74491f8d66b62a32440b288157b816d107..1536c9782041affa58f16fa16423480dc3db5a2e 100644 (file)
@@ -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, &reg_res);
                if (ret < 0) {
@@ -978,7 +978,7 @@ static int renesas_sdhi_probe(struct udevice *dev)
                }
 
                if (fdt_resource_size(&reg_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;