summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-mpc52xx-psc.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2023-03-06 21:31:11 +0300
committerMark Brown <broonie@kernel.org>2023-03-07 16:58:31 +0300
commitee493fa5d91dec02402239a072820b18beb36265 (patch)
tree1071728266c1329be5bc2bb482f4b8f8f7fad7ba /drivers/spi/spi-mpc52xx-psc.c
parentc7cc588bf0054ce33a11b98d05859105c046c706 (diff)
downloadlinux-ee493fa5d91dec02402239a072820b18beb36265.tar.xz
spi: mpc5xxx-psc: Correct error check for devm_platform_get_and_ioremap_resource()
devm_platform_get_and_ioremap_resource() may return pointer or error pointer, never the NULL. Correct error check for it. Fixes: 60a6c8257f41 ("spi: mpc5xxx-psc: Use platform resources instead of parsing DT properties") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230306183115.87314-2-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-mpc52xx-psc.c')
-rw-r--r--drivers/spi/spi-mpc52xx-psc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/spi/spi-mpc52xx-psc.c b/drivers/spi/spi-mpc52xx-psc.c
index 95a4a511c388..1bf728f4d766 100644
--- a/drivers/spi/spi-mpc52xx-psc.c
+++ b/drivers/spi/spi-mpc52xx-psc.c
@@ -321,8 +321,9 @@ static int mpc52xx_psc_spi_of_probe(struct platform_device *pdev)
master->dev.of_node = dev->of_node;
mps->psc = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
- if (!mps->psc)
- return dev_err_probe(dev, -EFAULT, "could not ioremap I/O port range\n");
+ if (IS_ERR(mps->psc))
+ return dev_err_probe(dev, PTR_ERR(mps->psc), "could not ioremap I/O port range\n");
+
/* On the 5200, fifo regs are immediately ajacent to the psc regs */
mps->fifo = ((void __iomem *)mps->psc) + sizeof(struct mpc52xx_psc);