From: Zhang Qilong <zhangqilong3@xxxxxxxxxx> If io map failed in devm_ioremap/devm_ioport_map, base or alt_base will be null, it will cause setup port error later but it won't be found out in plat_ide_setup_ports. Signed-off-by: Zhang Qilong <zhangqilong3@xxxxxxxxxx> --- drivers/ide/ide_platform.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/ide/ide_platform.c b/drivers/ide/ide_platform.c index 91639fd6c276..fdbc565ef142 100644 --- a/drivers/ide/ide_platform.c +++ b/drivers/ide/ide_platform.c @@ -86,6 +86,11 @@ static int plat_ide_probe(struct platform_device *pdev) res_alt->start, resource_size(res_alt)); } + if (!base || !alt_base) { + ret = -ENOMEM; + goto out; + } + memset(&hw, 0, sizeof(hw)); plat_ide_setup_ports(&hw, base, alt_base, pdata, res_irq->start); hw.dev = &pdev->dev; -- 2.17.1