Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753117AbdI1MyN (ORCPT ); Thu, 28 Sep 2017 08:54:13 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:23011 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753006AbdI1MyM (ORCPT ); Thu, 28 Sep 2017 08:54:12 -0400 Date: Thu, 28 Sep 2017 15:53:37 +0300 From: Dan Carpenter To: Ioana Radulescu Cc: devel@driverdev.osuosl.org, arnd@arndb.de, stuyoder@gmail.com, gregkh@linuxfoundation.org, roy.pledge@nxp.com, linux-kernel@vger.kernel.org, agraf@suse.de, bogdan.purcareata@nxp.com, laurentiu.tudor@nxp.com Subject: Re: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison Message-ID: <20170928125337.fl3pyuqi7jevz2no@mwanda> References: <20170927175728.3307-1-ruxandra.radulescu@nxp.com> <20170928124836.kdqjowqibab53hf5@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170928124836.kdqjowqibab53hf5@mwanda> User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 914 Lines: 26 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