Commit 604042af authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Mark Brown

spi: fsl-espi: improve return value handling in fsl_espi_probe

The return value of fsl_espi_probe (currently struct spi_master *)
is just used for checking whether an error occurred.
Change the return value type to int and simplify the code.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent acf69219
...@@ -538,8 +538,8 @@ static size_t fsl_espi_max_message_size(struct spi_device *spi) ...@@ -538,8 +538,8 @@ static size_t fsl_espi_max_message_size(struct spi_device *spi)
return SPCOM_TRANLEN_MAX; return SPCOM_TRANLEN_MAX;
} }
static struct spi_master * fsl_espi_probe(struct device *dev, static int fsl_espi_probe(struct device *dev, struct resource *mem,
struct resource *mem, unsigned int irq) unsigned int irq)
{ {
struct fsl_spi_platform_data *pdata = dev_get_platdata(dev); struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
struct spi_master *master; struct spi_master *master;
...@@ -547,13 +547,11 @@ static struct spi_master * fsl_espi_probe(struct device *dev, ...@@ -547,13 +547,11 @@ static struct spi_master * fsl_espi_probe(struct device *dev,
struct device_node *nc; struct device_node *nc;
const __be32 *prop; const __be32 *prop;
u32 regval, csmode; u32 regval, csmode;
int i, len, ret = 0; int i, len, ret;
master = spi_alloc_master(dev, sizeof(struct mpc8xxx_spi)); master = spi_alloc_master(dev, sizeof(struct mpc8xxx_spi));
if (!master) { if (!master)
ret = -ENOMEM; return -ENOMEM;
goto err;
}
dev_set_drvdata(dev, master); dev_set_drvdata(dev, master);
...@@ -647,7 +645,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev, ...@@ -647,7 +645,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev,
pm_runtime_mark_last_busy(dev); pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev); pm_runtime_put_autosuspend(dev);
return master; return 0;
err_pm: err_pm:
pm_runtime_put_noidle(dev); pm_runtime_put_noidle(dev);
...@@ -655,8 +653,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev, ...@@ -655,8 +653,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev,
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(dev);
err_probe: err_probe:
spi_master_put(master); spi_master_put(master);
err: return ret;
return ERR_PTR(ret);
} }
static int of_fsl_espi_get_chipselects(struct device *dev) static int of_fsl_espi_get_chipselects(struct device *dev)
...@@ -682,7 +679,6 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) ...@@ -682,7 +679,6 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
{ {
struct device *dev = &ofdev->dev; struct device *dev = &ofdev->dev;
struct device_node *np = ofdev->dev.of_node; struct device_node *np = ofdev->dev.of_node;
struct spi_master *master;
struct resource mem; struct resource mem;
unsigned int irq; unsigned int irq;
int ret; int ret;
...@@ -703,11 +699,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev) ...@@ -703,11 +699,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
if (!irq) if (!irq)
return -EINVAL; return -EINVAL;
master = fsl_espi_probe(dev, &mem, irq); return fsl_espi_probe(dev, &mem, irq);
if (IS_ERR(master))
return PTR_ERR(master);
return 0;
} }
static int of_fsl_espi_remove(struct platform_device *dev) static int of_fsl_espi_remove(struct platform_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment