Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933080AbcCOVu2 (ORCPT ); Tue, 15 Mar 2016 17:50:28 -0400 Received: from mail-bl2on0103.outbound.protection.outlook.com ([65.55.169.103]:49760 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753534AbcCOVuJ convert rfc822-to-8bit (ORCPT ); Tue, 15 Mar 2016 17:50:09 -0400 From: Hartley Sweeten To: Arnd Bergmann , Ian Abbott , "Greg Kroah-Hartman" CC: Amitoj Kaur Chawla , Bhaktipriya Shridhar , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] staging/comedi/dt282x: avoid integer overflow warning Thread-Topic: [PATCH] staging/comedi/dt282x: avoid integer overflow warning Thread-Index: AQHRfkOqoOuQ0v17NkiW6jbPL4yfgZ9bCEJQ Date: Tue, 15 Mar 2016 21:35:40 +0000 Message-ID: References: <1457995713-1517950-1-git-send-email-arnd@arndb.de> In-Reply-To: <1457995713-1517950-1-git-send-email-arnd@arndb.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: arndb.de; dkim=none (message not signed) header.d=none;arndb.de; dmarc=none action=none header.from=visionengravers.com; x-originating-ip: [184.183.19.121] x-ms-office365-filtering-correlation-id: e3cde18e-cc8a-4340-b653-08d34d19c1d4 x-microsoft-exchange-diagnostics: 1;BN3PR0101MB1060;5:cQgtydkeGLYn18PufEV3sW73oURDZ8d18/HMTkTX4+0P86l3a2vKVDM0mrZDB9/T0Y4175bqXcy2kwtA7mIfLv37HvjPE3+Q/ElpIEr25RJSxktAXR7NDImjAr+Lv4OUCfnjEOEoEAO343Ss+WPjiA==;24:UpOijkfvcUxf0KP6H32DL4CsqOEsmFz35viQYUu/2cFBU0Ajgu6l5xK3sfJ1kHAvDPfg4sV9rX/gyf7bqoayt3zvKqcuyY+A0doFV1WP5UI= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0101MB1060; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:BN3PR0101MB1060;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0101MB1060; x-forefront-prvs: 08828D20BC x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(24454002)(377454003)(74316001)(6116002)(3846002)(189998001)(5003600100002)(81166005)(77096005)(586003)(575784001)(87936001)(102836003)(92566002)(50986999)(122556002)(76176999)(3660700001)(33656002)(5004730100002)(2906002)(54356999)(3280700002)(19580395003)(80792005)(2900100001)(19580405001)(4326007)(11100500001)(2950100001)(5002640100001)(10400500002)(5001770100001)(1220700001)(1096002)(5008740100001)(106116001)(66066001)(86362001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN3PR0101MB1060;H:BN3PR0101MB1057.prod.exchangelabs.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: visionengravers.com X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2016 21:35:40.6304 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: d698601f-af92-4269-8099-fd6f11636477 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0101MB1060 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1220 Lines: 35 On Monday, March 14, 2016 3:48 PM, Arnd Bergmann wrote: > gcc-6 warns about passing negative signed integer into swab16() > in the dt282x driver: > The warning makes sense, though the code is correct as far as I > can tell. > > This disambiguates the operation by making the constant expressions > we pass here explicitly 'unsigned', which helps to avoid the warning. > > Signed-off-by: Arnd Bergmann > --- > drivers/staging/comedi/drivers/dt282x.c | 62 ++++++++++++++++----------------- > 1 file changed, 31 insertions(+), 31 deletions(-) > > diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c > index 40bf00984fa5..d4d45c759c62 100644 > --- a/drivers/staging/comedi/drivers/dt282x.c > +++ b/drivers/staging/comedi/drivers/dt282x.c > @@ -69,48 +69,48 @@ > * Register map > */ > #define DT2821_ADCSR_REG 0x00 > -#define DT2821_ADCSR_ADERR (1 << 15) > -#define DT2821_ADCSR_ADCLK (1 << 9) > -#define DT2821_ADCSR_MUXBUSY (1 << 8) > -#define DT2821_ADCSR_ADDONE (1 << 7) > -#define DT2821_ADCSR_IADDONE (1 << 6) > +#define DT2821_ADCSR_ADERR (1u << 15) Changing all of these to use the BIT() macro should also avoid the warning. Hartley