mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] spi: spi-nxp-fspi: Fix error checks
@ 2023-11-07 14:15 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2023-11-07 14:15 UTC (permalink / raw)
  To: Barebox List

We have to check dev_request_mem_resource() for errors, not the resource
address it returns.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/spi/spi-nxp-fspi.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 1d6604fee3..d8675779da 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -993,18 +993,19 @@ static int nxp_fspi_probe(struct device *dev)
 
 	/* find the resources */
 	res = dev_request_mem_resource(dev, 0);
-	f->iobase = IOMEM(res->start);
-	if (IS_ERR(f->iobase)) {
-		ret = PTR_ERR(f->iobase);
+	if (IS_ERR(res)) {
+		ret = PTR_ERR(res);
 		goto err_put_ctrl;
 	}
 
+	f->iobase = IOMEM(res->start);
+
 	res = dev_request_mem_resource(dev, 1);
-	f->ahb_addr = IOMEM(res->start);
-	if (IS_ERR(f->ahb_addr)) {
-		ret = PTR_ERR(f->ahb_addr);
+	if (IS_ERR(res)) {
+		ret = PTR_ERR(res);
 		goto err_put_ctrl;
 	}
+	f->ahb_addr = IOMEM(res->start);
 
 	/* assign memory mapped starting address and mapped size. */
 	f->memmap_phy = res->start;
-- 
2.39.2




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-07 14:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07 14:15 [PATCH] spi: spi-nxp-fspi: Fix error checks Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox