Skip to content
Snippets Groups Projects
Commit 90d76f81 authored by Adam Ford's avatar Adam Ford Committed by Jagan Teki
Browse files

spi: nxp_fspi: Fix error reporting


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: 383fded7 ("spi: nxp_fspi: new driver for the FlexSPI controller")
Signed-off-by: default avatarAdam Ford <aford173@gmail.com>
Reviewed-by: default avatarPratyush Yadav <p.yadav@ti.com>
Reviewed-by: default avatarJagan Teki <jagan@amarulasolutions.com>
parent de76ae36
No related branches found
No related tags found
No related merge requests found
......@@ -823,7 +823,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);
......@@ -914,7 +914,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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment