From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] spi: spi-nxp-fspi: Fix error checks
Date: Tue, 7 Nov 2023 15:15:59 +0100 [thread overview]
Message-ID: <20231107141559.2728828-1-s.hauer@pengutronix.de> (raw)
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
reply other threads:[~2023-11-07 14:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231107141559.2728828-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox