Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1741511

Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison
Date 2017-09-28 15:00 +0200
Message-ID <uuGA1-Fm-21@gated-at.bofh.it> (permalink)
References <uuGqm-C7-15@gated-at.bofh.it> <uuGqm-C7-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-28 14:50 +0200
  Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-28 15:00 +0200
  RE: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison Ruxandra Ioana Radulescu <ruxandra.radulescu@nxp.com> - 2017-09-28 15:10 +0200
    Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org> - 2017-09-28 15:20 +0200
      RE: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison Ruxandra Ioana Radulescu <ruxandra.radulescu@nxp.com> - 2017-09-28 15:30 +0200

csiph-web