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: 60a6c8257f ("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>
This commit is contained in:
Andy Shevchenko 2023-03-06 20:31:11 +02:00 committed by Mark Brown
parent c7cc588bf0
commit ee493fa5d9
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 5 additions and 4 deletions

View File

@ -483,8 +483,8 @@ static int mpc512x_psc_spi_of_probe(struct platform_device *pdev)
master->dev.of_node = dev->of_node;
tempp = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
if (!tempp)
return dev_err_probe(dev, -EFAULT, "could not ioremap I/O port range\n");
if (IS_ERR(tempp))
return dev_err_probe(dev, PTR_ERR(tempp), "could not ioremap I/O port range\n");
mps->psc = tempp;
mps->fifo =
(struct mpc512x_psc_fifo *)(tempp + sizeof(struct mpc52xx_psc));

View File

@ -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);