Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753270AbdI1NH4 (ORCPT ); Thu, 28 Sep 2017 09:07:56 -0400 Received: from mail-ve1eur01on0042.outbound.protection.outlook.com ([104.47.1.42]:59744 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753107AbdI1NHx (ORCPT ); Thu, 28 Sep 2017 09:07:53 -0400 From: Ruxandra Ioana Radulescu To: Dan Carpenter CC: "gregkh@linuxfoundation.org" , "devel@driverdev.osuosl.org" , "arnd@arndb.de" , "stuyoder@gmail.com" , Roy Pledge , "linux-kernel@vger.kernel.org" , "agraf@suse.de" , "Bogdan Purcareata" , Laurentiu Tudor Subject: RE: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison Thread-Topic: [PATCH] staging: fsl-mc/dpio: Fix incorrect comparison Thread-Index: AQHTN7oYgMCC9Nvla0+749/uaJzKTqLKQL4AgAAAVyA= Date: Thu, 28 Sep 2017 13:07:48 +0000 Message-ID: References: <20170927175728.3307-1-ruxandra.radulescu@nxp.com> <20170928124836.kdqjowqibab53hf5@mwanda> In-Reply-To: <20170928124836.kdqjowqibab53hf5@mwanda> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ruxandra.radulescu@nxp.com; x-originating-ip: [213.233.90.35] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB5PR04MB1237;6:9l00aBSTmHa5pTPP1cPMJfPtwpft9H3MTXHgnCbIqCtzyLyj4p62mhnp4aH8ouSu25pCI8f5ehfq4V/L2qypvHDXx/xDoidENSPqJky4YQPMURiUnjdxonR9ocPqrp3+/NQKLtaDCZWh1is8RVYERtU3aB5igHHNHN+SOi5uHihAQXy8JuBa5/KH1U7Z+MqHm5e+nfA5rrmAJ4kmyh8USa/auU3eiqYRuJVf6cBtI/O7IdSTmikD0HOpIFxhgTciJA1xdo+pycRld01q6vHEc+XNBYUjdv4sKCJq9bbI3vsScl4lgCgwBRf1wuXRpec/i8GgOraacpI5nLERlQit9Q==;5:Cqpgn+LbQHB5qbABBG4hAyAvgw9OIHOx9mr3ibjQVUhsbRN1w1Q7/l1tG3V0zQCpVlsMWl2Wk01EK6X2zQQGLWfZf/sQkMcWuQhqL++9A0I8VxUnqLAG9NWbi+h4cWtnMfcsifrotStdZf4skj2mYQ==;24:urmOvjaRCoGtWqrLmIoeG6S5aQ/02IZGO+2HnDLELqfzgVbWLfuCuG4gAxPpDks4CiYrpTByAMkB0NvNBnE+36yXasLoR54lW+4GjPEH9lU=;7:HFM4wNXsZRkxl8NsFOGdOz9qaJqkBa89kFxRfrWpFYP6ZPlmQypFw/bQLOqvrQcBEU5nFoTGu0ygle8X0xUeM0FG5CtLnTjpwqmd1Sq7wzc5UuKAjLYeoFrwaRp7CobCvrimdpe0fCIdytD8ZkBHspyHl3bKQLtPE+x8b7UyzjxEUuUv9gO2poB5K2Y1o5qlfSmLzhxmchP2ODz0BCyU+X/DMjC4dfddZACCTZ495g0= x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10009020)(6009001)(39860400002)(346002)(376002)(24454002)(377454003)(13464003)(189002)(199003)(6916009)(3846002)(8936002)(6116002)(102836003)(305945005)(14454004)(7696004)(316002)(33656002)(2906002)(5660300001)(99286003)(2950100002)(2900100001)(189998001)(9686003)(8676002)(53936002)(66066001)(86362001)(74316002)(81156014)(55016002)(7736002)(81166006)(25786009)(76176999)(6246003)(54356999)(101416001)(68736007)(50986999)(3660700001)(5250100002)(54906003)(39060400002)(3280700002)(53546010)(6436002)(4326008)(105586002)(478600001)(97736004)(6506006)(229853002)(106356001);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR04MB1237;H:VI1PR0402MB2847.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-ms-office365-filtering-correlation-id: e7bd4cd3-cc3a-46c3-0fbd-08d50671eb1d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254152)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075);SRVR:DB5PR04MB1237; x-ms-traffictypediagnostic: DB5PR04MB1237: x-exchange-antispam-report-test: UriScan:(9452136761055)(185117386973197)(146099531331640); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DB5PR04MB1237;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DB5PR04MB1237; x-forefront-prvs: 0444EB1997 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Sep 2017 13:07:48.7008 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR04MB1237 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v8SD80Gi021698 Content-Length: 1521 Lines: 43 > -----Original Message----- > From: Dan Carpenter [mailto:dan.carpenter@oracle.com] > Sent: Thursday, September 28, 2017 3:49 PM > To: Ruxandra Ioana Radulescu > Cc: gregkh@linuxfoundation.org; devel@driverdev.osuosl.org; > arnd@arndb.de; stuyoder@gmail.com; Roy Pledge ; > linux-kernel@vger.kernel.org; agraf@suse.de; Bogdan Purcareata > ; Laurentiu Tudor > > 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