soc/qbman: Fix resource leak on portal probing error path
In case init_pcfg() returns with error the CI region must be unmapped too. Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com> Signed-off-by: Scott Wood <oss@buserror.net>
This commit is contained in:
parent
d95cb0d361
commit
333e72cf47
|
@ -146,15 +146,19 @@ static int bman_portal_probe(struct platform_device *pdev)
|
||||||
pcfg->irq = irq;
|
pcfg->irq = irq;
|
||||||
|
|
||||||
va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]), 0);
|
va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]), 0);
|
||||||
if (!va)
|
if (!va) {
|
||||||
|
dev_err(dev, "ioremap::CE failed\n");
|
||||||
goto err_ioremap1;
|
goto err_ioremap1;
|
||||||
|
}
|
||||||
|
|
||||||
pcfg->addr_virt[DPAA_PORTAL_CE] = va;
|
pcfg->addr_virt[DPAA_PORTAL_CE] = va;
|
||||||
|
|
||||||
va = ioremap_prot(addr_phys[1]->start, resource_size(addr_phys[1]),
|
va = ioremap_prot(addr_phys[1]->start, resource_size(addr_phys[1]),
|
||||||
_PAGE_GUARDED | _PAGE_NO_CACHE);
|
_PAGE_GUARDED | _PAGE_NO_CACHE);
|
||||||
if (!va)
|
if (!va) {
|
||||||
|
dev_err(dev, "ioremap::CI failed\n");
|
||||||
goto err_ioremap2;
|
goto err_ioremap2;
|
||||||
|
}
|
||||||
|
|
||||||
pcfg->addr_virt[DPAA_PORTAL_CI] = va;
|
pcfg->addr_virt[DPAA_PORTAL_CI] = va;
|
||||||
|
|
||||||
|
@ -170,8 +174,10 @@ static int bman_portal_probe(struct platform_device *pdev)
|
||||||
spin_unlock(&bman_lock);
|
spin_unlock(&bman_lock);
|
||||||
pcfg->cpu = cpu;
|
pcfg->cpu = cpu;
|
||||||
|
|
||||||
if (!init_pcfg(pcfg))
|
if (!init_pcfg(pcfg)) {
|
||||||
goto err_ioremap2;
|
dev_err(dev, "portal init failed\n");
|
||||||
|
goto err_portal_init;
|
||||||
|
}
|
||||||
|
|
||||||
/* clear irq affinity if assigned cpu is offline */
|
/* clear irq affinity if assigned cpu is offline */
|
||||||
if (!cpu_online(cpu))
|
if (!cpu_online(cpu))
|
||||||
|
@ -179,10 +185,11 @@ static int bman_portal_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_portal_init:
|
||||||
|
iounmap(pcfg->addr_virt[DPAA_PORTAL_CI]);
|
||||||
err_ioremap2:
|
err_ioremap2:
|
||||||
iounmap(pcfg->addr_virt[DPAA_PORTAL_CE]);
|
iounmap(pcfg->addr_virt[DPAA_PORTAL_CE]);
|
||||||
err_ioremap1:
|
err_ioremap1:
|
||||||
dev_err(dev, "ioremap failed\n");
|
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,15 +280,19 @@ static int qman_portal_probe(struct platform_device *pdev)
|
||||||
pcfg->irq = irq;
|
pcfg->irq = irq;
|
||||||
|
|
||||||
va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]), 0);
|
va = ioremap_prot(addr_phys[0]->start, resource_size(addr_phys[0]), 0);
|
||||||
if (!va)
|
if (!va) {
|
||||||
|
dev_err(dev, "ioremap::CE failed\n");
|
||||||
goto err_ioremap1;
|
goto err_ioremap1;
|
||||||
|
}
|
||||||
|
|
||||||
pcfg->addr_virt[DPAA_PORTAL_CE] = va;
|
pcfg->addr_virt[DPAA_PORTAL_CE] = va;
|
||||||
|
|
||||||
va = ioremap_prot(addr_phys[1]->start, resource_size(addr_phys[1]),
|
va = ioremap_prot(addr_phys[1]->start, resource_size(addr_phys[1]),
|
||||||
_PAGE_GUARDED | _PAGE_NO_CACHE);
|
_PAGE_GUARDED | _PAGE_NO_CACHE);
|
||||||
if (!va)
|
if (!va) {
|
||||||
|
dev_err(dev, "ioremap::CI failed\n");
|
||||||
goto err_ioremap2;
|
goto err_ioremap2;
|
||||||
|
}
|
||||||
|
|
||||||
pcfg->addr_virt[DPAA_PORTAL_CI] = va;
|
pcfg->addr_virt[DPAA_PORTAL_CI] = va;
|
||||||
|
|
||||||
|
@ -306,8 +310,10 @@ static int qman_portal_probe(struct platform_device *pdev)
|
||||||
spin_unlock(&qman_lock);
|
spin_unlock(&qman_lock);
|
||||||
pcfg->cpu = cpu;
|
pcfg->cpu = cpu;
|
||||||
|
|
||||||
if (!init_pcfg(pcfg))
|
if (!init_pcfg(pcfg)) {
|
||||||
goto err_ioremap2;
|
dev_err(dev, "portal init failed\n");
|
||||||
|
goto err_portal_init;
|
||||||
|
}
|
||||||
|
|
||||||
/* clear irq affinity if assigned cpu is offline */
|
/* clear irq affinity if assigned cpu is offline */
|
||||||
if (!cpu_online(cpu))
|
if (!cpu_online(cpu))
|
||||||
|
@ -315,10 +321,11 @@ static int qman_portal_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_portal_init:
|
||||||
|
iounmap(pcfg->addr_virt[DPAA_PORTAL_CI]);
|
||||||
err_ioremap2:
|
err_ioremap2:
|
||||||
iounmap(pcfg->addr_virt[DPAA_PORTAL_CE]);
|
iounmap(pcfg->addr_virt[DPAA_PORTAL_CE]);
|
||||||
err_ioremap1:
|
err_ioremap1:
|
||||||
dev_err(dev, "ioremap failed\n");
|
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue