From: Adam Ford <aford173@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 1/2] spi: nxp_fspi: Fix error reporting
Date: Mon, 18 Jan 2021 15:32:49 -0600 [thread overview]
Message-ID: <20210118213250.727994-1-aford173@gmail.com> (raw)
On the i.MX8M Mini, ret = clk_set_rate() sets ret to the value of the
rate the clock was able to set. When checking for errors, it only
checks that it is not NULL. Since positive numbers are not errors,
only check for negative numbers when handling errors.
Fixes: 383fded70c4f ("spi: nxp_fspi: new driver for the FlexSPI controller")
Signed-off-by: Adam Ford <aford173@gmail.com>
diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c
index 006dd04b9e..d74561578a 100644
--- a/drivers/spi/nxp_fspi.c
+++ b/drivers/spi/nxp_fspi.c
@@ -815,7 +815,7 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)
/* the default frequency, we will change it later if necessary. */
ret = clk_set_rate(&f->clk, 20000000);
- if (ret)
+ if (ret < 0)
return ret;
ret = nxp_fspi_clk_prep_enable(f);
@@ -906,7 +906,7 @@ static int nxp_fspi_set_speed(struct udevice *bus, uint speed)
nxp_fspi_clk_disable_unprep(f);
ret = clk_set_rate(&f->clk, speed);
- if (ret)
+ if (ret < 0)
return ret;
ret = nxp_fspi_clk_prep_enable(f);
--
2.25.1
next reply other threads:[~2021-01-18 21:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 21:32 Adam Ford [this message]
2021-01-18 21:32 ` [PATCH 2/2] spi: nxp_fspi: Enable support for nxp,imx8mm-fspi Adam Ford
2021-01-23 15:50 ` sbabic at denx.de
2021-01-19 12:12 ` [PATCH 1/2] spi: nxp_fspi: Fix error reporting Pratyush Yadav
2021-02-23 12:59 ` Adam Ford
2021-02-26 9:41 ` Jagan Teki
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=20210118213250.727994-1-aford173@gmail.com \
--to=aford173@gmail.com \
--cc=u-boot@lists.denx.de \
/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