env: move more common code to env_import_redund
[oweals/u-boot.git] / drivers / mmc / exynos_dw_mmc.c
index c440399a09cfa38e0dd569a68c7a8c347ad3633a..e40575e58922a1449d4e09aad9d999dec03df43b 100644 (file)
@@ -155,7 +155,7 @@ static int exynos_dwmci_get_config(const void *blob, int node,
 
        priv = malloc(sizeof(struct dwmci_exynos_priv_data));
        if (!priv) {
-               error("dwmci_exynos_priv_data malloc fail!\n");
+               pr_err("dwmci_exynos_priv_data malloc fail!\n");
                return -ENOMEM;
        }
 
@@ -168,6 +168,7 @@ static int exynos_dwmci_get_config(const void *blob, int node,
 
        if (host->dev_index > 4) {
                printf("DWMMC%d: Can't get the dev index\n", host->dev_index);
+               free(priv);
                return -EINVAL;
        }
 
@@ -178,6 +179,7 @@ static int exynos_dwmci_get_config(const void *blob, int node,
        base = fdtdec_get_addr(blob, node, "reg");
        if (!base) {
                printf("DWMMC%d: Can't get base address\n", host->dev_index);
+               free(priv);
                return -EINVAL;
        }
        host->ioaddr = (void *)base;
@@ -187,6 +189,7 @@ static int exynos_dwmci_get_config(const void *blob, int node,
        if (err) {
                printf("DWMMC%d: Can't get sdr-timings for devider\n",
                                host->dev_index);
+               free(priv);
                return -EINVAL;
        }
 
@@ -264,7 +267,7 @@ static int exynos_dwmmc_probe(struct udevice *dev)
        struct dwmci_host *host = &priv->host;
        int err;
 
-       err = exynos_dwmci_get_config(gd->fdt_blob, dev->of_offset, host);
+       err = exynos_dwmci_get_config(gd->fdt_blob, dev_of_offset(dev), host);
        if (err)
                return err;
        err = do_dwmci_init(host);