diff mbox series

[1/2] spi: nxp_fspi: Fix error reporting

Message ID 20210118213250.727994-1-aford173@gmail.com
State Accepted
Commit 90d76f812b29c88f47279eca034da70d30a798d9
Delegated to: Stefano Babic
Headers show
Series [1/2] spi: nxp_fspi: Fix error reporting | expand

Commit Message

Adam Ford Jan. 18, 2021, 9:32 p.m. UTC
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>

Comments

Pratyush Yadav Jan. 19, 2021, 12:12 p.m. UTC | #1
On 18/01/21 03:32PM, Adam Ford wrote:
> 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>

Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Adam Ford Feb. 23, 2021, 12:59 p.m. UTC | #2
On Tue, Jan 19, 2021 at 6:12 AM Pratyush Yadav <p.yadav@ti.com> wrote:
>
> On 18/01/21 03:32PM, Adam Ford wrote:
> > 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>
>
> Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
>
Jagan,

Is this something you can take, or do I need to add someone to the CC
list?  It's been nearly a month, and it's holding up the ability for a
QSPI driver on two boards.

thanks,

adam


> --
> Regards,
> Pratyush Yadav
> Texas Instruments India
Jagan Teki Feb. 26, 2021, 9:41 a.m. UTC | #3
On Tue, Feb 23, 2021 at 6:29 PM Adam Ford <aford173@gmail.com> wrote:
>
> On Tue, Jan 19, 2021 at 6:12 AM Pratyush Yadav <p.yadav@ti.com> wrote:
> >
> > On 18/01/21 03:32PM, Adam Ford wrote:
> > > 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>
> >
> > Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
> >
> Jagan,
>
> Is this something you can take, or do I need to add someone to the CC
> list?  It's been nearly a month, and it's holding up the ability for a
> QSPI driver on two boards.

Didn't find it via patchwork before, thanks for notifying me.

Applied to u-boot-spi/master
diff mbox series

Patch

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);