diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2018-04-27 17:07:33 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-29 15:25:08 +0200 |
commit | 503075521d8dc8941c1edc03460c009b8fc71d54 (patch) | |
tree | a6769fd52aa10162deb50ec71116e6d226fd0001 /drivers/staging/fsl-mc | |
parent | 3c2b8df02c726f166d7fc4a7260cc4acde489b4a (diff) |
staging: fsl-mc/dpio: Fix the error handling in probe()
First of all devm_memremap() function returns an error pointer, it
doesn't return NULL. And second we need to set the error code on these
paths.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fsl-mc')
-rw-r--r-- | drivers/staging/fsl-mc/bus/dpio/dpio-driver.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c index 9e125769a4e7..11a90a90d827 100644 --- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c @@ -150,14 +150,16 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) desc.regs_cena = devm_memremap(dev, dpio_dev->regions[1].start, resource_size(&dpio_dev->regions[1]), MEMREMAP_WC); - if (!desc.regs_cena) { + if (IS_ERR(desc.regs_cena)) { dev_err(dev, "devm_memremap failed\n"); + err = PTR_ERR(desc.regs_cena); goto err_allocate_irqs; } desc.regs_cinh = devm_ioremap(dev, dpio_dev->regions[1].start, resource_size(&dpio_dev->regions[1])); if (!desc.regs_cinh) { + err = -ENOMEM; dev_err(dev, "devm_ioremap failed\n"); goto err_allocate_irqs; } @@ -175,6 +177,7 @@ static int dpaa2_dpio_probe(struct fsl_mc_device *dpio_dev) priv->io = dpaa2_io_create(&desc); if (!priv->io) { dev_err(dev, "dpaa2_io_create failed\n"); + err = -ENOMEM; goto err_dpaa2_io_create; } |