Skip to contentSkip to conversation

mmc: omap_hsmmc: checking for ERR_PTR instead of NULL

PATCH In review Dan Carpenter 2 participants 2 messages Jan 30, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 mmc: omap_hsmmc: checking for ERR_PTR instead of NULL

The of_get_hsmmc_pdata() function returns NULL on error, it doesn't return ERR_PTRs.

drivers/mmc/host/omap_hsmmc.c +2 -3
index bfb0dbd052c0..76dbc7b759c2 100644
@@ -1761,9 +1761,8 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
 	match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev);
 	if (match) {
 		pdata = of_get_hsmmc_pdata(&pdev->dev);
-
-		if (IS_ERR(pdata))
-			return PTR_ERR(pdata);
+		if (!pdata)
+			return -ENOMEM;
 
 		if (match->data) {
 			const u16 *offsetp = match->data;
#1 lore raw
Quoted 10 lines · Dan Carpenter

The of_get_hsmmc_pdata() function returns NULL on error, it doesn't return ERR_PTRs.

drivers/mmc/host/omap_hsmmc.c +0 -0
index bfb0dbd052c0..76dbc7b759c2 100644

drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_probe(struct platform_device *pdev) · line 1765

Quoted 8 lines
drivers/mmc/host/omap_hsmmc.c +2 -3
@@ -1761,9 +1761,8 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
  	match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev);
  	if (match) {
  		pdata = of_get_hsmmc_pdata(&pdev->dev);
-
-		if (IS_ERR(pdata))
-			return PTR_ERR(pdata);
+		if (!pdata)
+			return -ENOMEM;

Thanks for reporting this.
Caller needs to be fixed. I will send a patch to fix this.

Quoted 4 lines
drivers/mmc/host/omap_hsmmc.c +0 -0
  		if (match->data) {
  			const u16 *offsetp = match->data;