diff mbox series

[next] spi: spi_amd: Fix an IS_ERR() vs NULL check in probe

Message ID 0e0f5ede-8993-4fac-967c-51e46b095416@stanley.mountain
State New
Headers show
Series [next] spi: spi_amd: Fix an IS_ERR() vs NULL check in probe | expand

Commit Message

Dan Carpenter April 9, 2025, 11 a.m. UTC
The devm_ioremap() function returns NULL on error, it doesn't
return error pointers.  Update the error checking to match.

Fixes: b644c2776652 ("spi: spi_amd: Add PCI-based driver for AMD HID2 SPI controller")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/spi/spi-amd-pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown April 9, 2025, 8:18 p.m. UTC | #1
On Wed, 09 Apr 2025 14:00:35 +0300, Dan Carpenter wrote:
> The devm_ioremap() function returns NULL on error, it doesn't
> return error pointers.  Update the error checking to match.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: spi_amd: Fix an IS_ERR() vs NULL check in probe
      commit: e686365c0411275474527c2055ac133f2eb47526

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
diff mbox series

Patch

diff --git a/drivers/spi/spi-amd-pci.c b/drivers/spi/spi-amd-pci.c
index e1ecab755fe9..e5faab414c17 100644
--- a/drivers/spi/spi-amd-pci.c
+++ b/drivers/spi/spi-amd-pci.c
@@ -46,8 +46,8 @@  static int amd_spi_pci_probe(struct pci_dev *pdev,
 	io_base_addr = (io_base_addr & AMD_SPI_BASE_ADDR_MASK) + AMD_HID2_PCI_BAR_OFFSET;
 	amd_spi->io_remap_addr = devm_ioremap(dev, io_base_addr, AMD_HID2_MEM_SIZE);
 
-	if (IS_ERR(amd_spi->io_remap_addr))
-		return dev_err_probe(dev, PTR_ERR(amd_spi->io_remap_addr),
+	if (!amd_spi->io_remap_addr)
+		return dev_err_probe(dev, -ENOMEM,
 				"ioremap of SPI registers failed\n");
 
 	dev_dbg(dev, "io_remap_address: %p\n", amd_spi->io_remap_addr);