netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Clément Léger" <clement.leger@bootlin.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Pavel Skripkin <paskripkin@gmail.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	"alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>,
	"UNGLinuxDriver@microchip.com" <UNGLinuxDriver@microchip.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"dan.carpenter@oracle.com" <dan.carpenter@oracle.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net: ocelot: fix wront time_after usage
Date: Fri, 20 May 2022 10:21:51 +0200	[thread overview]
Message-ID: <20220520102151.411c8e35@fixe.home> (raw)
In-Reply-To: <20220519231300.k6hizfdu5chi7lpu@skbuf>

Le Thu, 19 May 2022 23:13:01 +0000,
Vladimir Oltean <vladimir.oltean@nxp.com> a écrit :

> On Thu, May 19, 2022 at 11:40:17PM +0300, Pavel Skripkin wrote:
> > Accidentally noticed, that this driver is the only user of
> > while (timer_after(jiffies...)).
> > 
> > It looks like typo, because likely this while loop will finish after 1st
> > iteration, because time_after() returns true when 1st argument _is after_
> > 2nd one.
> > 
> > Fix it by negating time_after return value inside while loops statement
> > 
> > Fixes: 753a026cfec1 ("net: ocelot: add FDMA support")
> > Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> > ---
> >  drivers/net/ethernet/mscc/ocelot_fdma.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/mscc/ocelot_fdma.c b/drivers/net/ethernet/mscc/ocelot_fdma.c
> > index dffa597bffe6..4500fed3ce5c 100644
> > --- a/drivers/net/ethernet/mscc/ocelot_fdma.c
> > +++ b/drivers/net/ethernet/mscc/ocelot_fdma.c
> > @@ -104,7 +104,7 @@ static int ocelot_fdma_wait_chan_safe(struct ocelot *ocelot, int chan)
> >  		safe = ocelot_fdma_readl(ocelot, MSCC_FDMA_CH_SAFE);
> >  		if (safe & BIT(chan))
> >  			return 0;
> > -	} while (time_after(jiffies, timeout));
> > +	} while (!time_after(jiffies, timeout));
> >  
> >  	return -ETIMEDOUT;
> >  }
> > -- 
> > 2.36.1
> >  
> 
> +Clement. Also, there seems to be a typo in the commit message (wront -> wrong),
> but maybe this isn't so important.

Hi Pavel,

Thanks for this fix which is indeed necessary.

Acked-by: Clément Léger <clement.leger@bootlin.com>


-- 
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

  reply	other threads:[~2022-05-20  8:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19 20:40 [PATCH] net: ocelot: fix wront time_after usage Pavel Skripkin
2022-05-19 23:13 ` Vladimir Oltean
2022-05-20  8:21   ` Clément Léger [this message]
2022-05-20 12:40 ` Andrew Lunn
2022-05-20 21:06   ` Pavel Skripkin
2022-05-20 21:31   ` [PATCH v2] net: ocelot: fix wrong " Pavel Skripkin
2022-05-21 13:55     ` Andrew Lunn
2022-05-21 16:21       ` Vladimir Oltean
2022-05-23 14:00         ` Clément Léger
2022-05-27  3:42           ` Jakub Kicinski
2022-06-24 15:14         ` Clément Léger
2022-06-27 14:46           ` Pavel Skripkin

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=20220520102151.411c8e35@fixe.home \
    --to=clement.leger@bootlin.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paskripkin@gmail.com \
    --cc=vladimir.oltean@nxp.com \
    /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;
as well as URLs for NNTP newsgroup(s).