mmc: omap_hsmmc: checking for ERR_PTR instead of NULL
Subsystems (3)
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.
Signed-off-by Dan Carpenter <[email protected]>
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 ;if (match->data) {const u16 *offsetp = match->data;
Quoted 10 lines · Dan Carpenter
The
of_get_hsmmc_pdata()function returns NULL on error, it doesn't returnERR_PTRs.Signed-off-by Dan Carpenter <[email protected]>drivers/mmc/host/omap_hsmmc.c +0
-0
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
-0if (match->data) {const u16 *offsetp = match->data;