Skip to contentSkip to conversation

spi: aspeed: Fix an IS_ERR() vs NULL bug in probe()

PATCH In review Dan Carpenter 2 participants 2 messages Oct 17, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: aspeed: Fix an IS_ERR() vs NULL bug in probe()

The platform_get_resource() function doesn't return error pointers, it returns NULL on error. Update the error checking to match.

Fixes 64d87ccfae33 ("spi: aspeed: Only map necessary address window region")
---
 drivers/spi/spi-aspeed-smc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-aspeed-smc.c +2 -2
index 0c3de371fd39..822df89cb787 100644
@@ -865,9 +865,9 @@ static int aspeed_spi_probe(struct platform_device *pdev)
 		return PTR_ERR(aspi->regs);
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (IS_ERR(res)) {
+	if (!res) {
 		dev_err(dev, "missing AHB memory\n");
-		return PTR_ERR(res);
+		return -EINVAL;
 	}
 
 	aspi->ahb_window_size = resource_size(res);
Signature · 1 line
2.51.0
maintainer
#1 lore raw
Quoted 4 lines · Dan Carpenter

The platform_get_resource() function doesn't return error pointers, it returns NULL on error. 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: aspeed: Fix an IS_ERR() vs NULL bug in probe()

      commit: 0cc08c8130ac8f74419f99fe707dc193b7f79d86

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