Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752983AbdI1Mtk (ORCPT ); Thu, 28 Sep 2017 08:49:40 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:33385 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752190AbdI1Mtj (ORCPT ); Thu, 28 Sep 2017 08:49:39 -0400 Date: Thu, 28 Sep 2017 15:48:36 +0300 From: Dan Carpenter To: Ioana Radulescu Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, arnd@arndb.de, stuyoder@gmail.com, 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: <20170928124836.kdqjowqibab53hf5@mwanda> References: <20170927175728.3307-1-ruxandra.radulescu@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170927175728.3307-1-ruxandra.radulescu@nxp.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 742 Lines: 23 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()) return NULL; Same for the other one as well. regards, dan carpenter