> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Thursday, September 28, 2017 3:49 PM
> To: Ruxandra Ioana Radulescu <ruxandra.radule...@nxp.com>
> Cc: gre...@linuxfoundation.org; de...@driverdev.osuosl.org;
> a...@arndb.de; stuyo...@gmail.com; Roy Pledge <roy.ple...@nxp.com>;
> linux-ker...@vger.kernel.org; ag...@suse.de; Bogdan Purcareata
> <bogdan.purcare...@nxp.com>; Laurentiu Tudor
> <laurentiu.tu...@nxp.com>
> Subject: Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison
> 
> On Wed, Sep 27, 2017 at 12:57:28PM -0500, Ioana Radulescu wrote:
> > diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> > index f809682..26922fc 100644
> > --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> > +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c
> > @@ -76,7 +76,7 @@ static inline struct dpaa2_io
> *service_select_by_cpu(struct dpaa2_io *d,
> >     if (d)
> >             return d;
> >
> > -   if (unlikely(cpu >= num_possible_cpus()))
> > +   if (unlikely(cpu >= (int)num_possible_cpus()))
> 
> 
> Drivers shouldn't use likely/unlikley.
 
I was under the impression it's ok to use them on hotpath
(and while not entirely obvious, this function is called on
other drivers' hotpath).

> Please write it more explicitly like this:
> 
>       if (cpu != -1 && cpu >= num_possible_cpus())
>               return NULL;
> 
> Same for the other one as well.

Will rewrite as you suggested in the second email and send a v2.

Thanks,
Ioana
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to