lkml.org 
[lkml]   [2017]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison
On Thu, Sep 28, 2017 at 03:48:36PM +0300, Dan Carpenter wrote:
> 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. Please write it more explicitly
> like this:
>
> if (cpu != -1 && cpu >= num_possible_cpus())

This would probably be more readable as a define.

if (cpu != DPAA_ANY_CPU && cpu >= num_possible_cpus())
return NULL;

regards,
dan carpenter

\
 
 \ /
  Last update: 2017-09-28 14:54    [W:0.054 / U:2.388 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site