@@ -355,8 +355,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
}
host = tmio_mmc_host_alloc(pdev);
- if (!host) {
- ret = -ENOMEM;
+ if (IS_ERR(host)) {
+ ret = PTR_ERR(host);
goto eprobe;
}
@@ -93,8 +93,10 @@ static int tmio_mmc_probe(struct platform_device *pdev)
pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
host = tmio_mmc_host_alloc(pdev);
- if (!host)
+ if (IS_ERR(host)) {
+ ret = PTR_ERR(host);
goto cell_disable;
+ }
/* SD control register space size is 0x200, 0x400 for bus_shift=1 */
host->bus_shift = resource_size(res) >> 10;
@@ -1014,7 +1014,7 @@ struct tmio_mmc_host*
mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
if (IS_ERR(mmc))
- return NULL;
+ return ERR_CAST(mmc);
host = mmc_priv(mmc);
host->mmc = mmc;
Now, mmc_alloc_host() returns an error pointer when it fails. So, tmio_mmc_host_alloc() can also return an error pointer to propagate the proper error code. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- drivers/mmc/host/sh_mobile_sdhi.c | 4 ++-- drivers/mmc/host/tmio_mmc.c | 4 +++- drivers/mmc/host/tmio_mmc_pio.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) -- 1.9.1