mmc: omap_hsmmc: fix return error code for of_get_hsmmc_pdata
authorBalaji T K <balajitk@ti.com>
Fri, 28 Feb 2014 13:38:18 +0000 (19:08 +0530)
committerChris Ball <chris@printf.net>
Tue, 4 Mar 2014 16:45:02 +0000 (11:45 -0500)
of_get_hsmmc_pdata returns a pointer, returning NULL is invalid,
return ERR_PTR for error case.

Signed-off-by: Balaji T K <balajitk@ti.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chris Ball <chris@printf.net>
drivers/mmc/host/omap_hsmmc.c

index cc7e84f28c182f243ab74f8236eeb8b1cac30595..f4e5a59a84c087966a71c01b87be66b826d7655b 100644 (file)
@@ -1740,7 +1740,7 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
 
        pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
        if (!pdata)
-               return NULL; /* out of memory */
+               return ERR_PTR(-ENOMEM); /* out of memory */
 
        if (of_find_property(np, "ti,dual-volt", NULL))
                pdata->controller_flags |= OMAP_HSMMC_SUPPORTS_DUAL_VOLT;
@@ -1781,7 +1781,7 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
 static inline struct omap_mmc_platform_data
                        *of_get_hsmmc_pdata(struct device *dev)
 {
-       return NULL;
+       return ERR_PTR(-EINVAL);
 }
 #endif