mmc: sdricoh_cs: Less checks in sdricoh_init_mmc() after, error detection
This issue was detected by using the Coccinelle software. Two pointer checks could be repeated by the sdricoh_init_mmc() function during error handling even if the relevant properties can be determined for the involved variables before by source code analysis. * This implementation detail could be improved by adjustments for jump targets according to the Linux coding style convention. * Drop an unnecessary initialisation for the variable "mmc" then. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
c48c5d580e
commit
1856de3d3e
drivers/mmc/host
|
@ -400,7 +400,7 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
void __iomem *iobase;
|
void __iomem *iobase;
|
||||||
struct mmc_host *mmc = NULL;
|
struct mmc_host *mmc;
|
||||||
struct sdricoh_host *host;
|
struct sdricoh_host *host;
|
||||||
struct device *dev = &pcmcia_dev->dev;
|
struct device *dev = &pcmcia_dev->dev;
|
||||||
/* map iomem */
|
/* map iomem */
|
||||||
|
@ -419,7 +419,7 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
|
||||||
if (readl(iobase + R104_VERSION) != 0x4000) {
|
if (readl(iobase + R104_VERSION) != 0x4000) {
|
||||||
dev_dbg(dev, "no supported mmc controller found\n");
|
dev_dbg(dev, "no supported mmc controller found\n");
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto err;
|
goto unmap_io;
|
||||||
}
|
}
|
||||||
/* allocate privdata */
|
/* allocate privdata */
|
||||||
mmc = pcmcia_dev->priv =
|
mmc = pcmcia_dev->priv =
|
||||||
|
@ -427,7 +427,7 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
|
||||||
if (!mmc) {
|
if (!mmc) {
|
||||||
dev_err(dev, "mmc_alloc_host failed\n");
|
dev_err(dev, "mmc_alloc_host failed\n");
|
||||||
result = -ENOMEM;
|
result = -ENOMEM;
|
||||||
goto err;
|
goto unmap_io;
|
||||||
}
|
}
|
||||||
host = mmc_priv(mmc);
|
host = mmc_priv(mmc);
|
||||||
|
|
||||||
|
@ -451,8 +451,7 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
|
||||||
if (sdricoh_reset(host)) {
|
if (sdricoh_reset(host)) {
|
||||||
dev_dbg(dev, "could not reset\n");
|
dev_dbg(dev, "could not reset\n");
|
||||||
result = -EIO;
|
result = -EIO;
|
||||||
goto err;
|
goto free_host;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = mmc_add_host(mmc);
|
result = mmc_add_host(mmc);
|
||||||
|
@ -461,13 +460,10 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
|
||||||
dev_dbg(dev, "mmc host registered\n");
|
dev_dbg(dev, "mmc host registered\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
free_host:
|
||||||
err:
|
mmc_free_host(mmc);
|
||||||
if (iobase)
|
unmap_io:
|
||||||
pci_iounmap(pci_dev, iobase);
|
pci_iounmap(pci_dev, iobase);
|
||||||
if (mmc)
|
|
||||||
mmc_free_host(mmc);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue