From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752453AbcFPKcK (ORCPT ); Thu, 16 Jun 2016 06:32:10 -0400 Received: from nbfkord-smmo02.seg.att.com ([209.65.160.78]:63178 "EHLO nbfkord-smmo02.seg.att.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754144AbcFPKcG (ORCPT ); Thu, 16 Jun 2016 06:32:06 -0400 X-MXL-Hash: 5762802616daf2ce-74e6ffaaa483a407d6cee8dea48c75dd029d5686 X-MXL-Hash: 57628025320d9096-8d768c708c0cff10e97386342cd04ebe9b598072 Subject: Re: [PATCH] net: sfc: avoid -Wtype-limits warning To: Arnd Bergmann , Solarflare linux maintainers , Edward Cree References: <20160615203122.3574513-1-arnd@arndb.de> CC: "David S. Miller" , Martin Habets , , From: Bert Kenward Organization: Solarflare Message-ID: <3f85b364-6913-1ed5-0bc0-19aa2edc59f6@solarflare.com> Date: Thu, 16 Jun 2016 11:31:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <20160615203122.3574513-1-arnd@arndb.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.17.20.82] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22394.003 X-TM-AS-Result: No--8.150400-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-AnalysisOut: [v=2.1 cv=fpPaEQMf c=1 sm=1 tr=0 a=8P+NB+fYZDP74ap4g4d9Kw==] X-AnalysisOut: [:17 a=OjXlt12Agc0A:10 a=IkcTkHD0fZMA:10 a=pD_ry4oyNxEA:10 ] X-AnalysisOut: [a=zRKbQ67AAAAA:8 a=OejMVaaly5HQHPcFRNUA:9 a=nTlna9p36FDxl8] X-AnalysisOut: [JO:21 a=Lj8PKTkRrb89sarL:21 a=QEXdDO2ut3YA:10 a=PA03WX8tBz] X-AnalysisOut: [eizutn5_OT:22] X-Spam: [F=0.2000000000; CM=0.500; S=0.200(2015072901)] X-MAIL-FROM: X-SOURCE-IP: [193.34.186.16] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/06/16 21:31, Arnd Bergmann wrote: > When building with -Wextra, we get a harmless warning from the > EFX_EXTRACT_OWORD32 macro: > > ethernet/sfc/farch.c: In function 'efx_farch_test_registers': > ethernet/sfc/farch.c:119:30: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] > ethernet/sfc/farch.c:124:144: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] > ethernet/sfc/farch.c:124:392: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] > ethernet/sfc/farch.c:124:731: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits] > > The macro and the caller are both correct, but we can avoid the > warning by changing the index variable to a signed type. > > Signed-off-by: Arnd Bergmann Acked-by: Bert Kenward > --- > drivers/net/ethernet/sfc/farch.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c > index 133e9e35be9e..4c83739d158f 100644 > --- a/drivers/net/ethernet/sfc/farch.c > +++ b/drivers/net/ethernet/sfc/farch.c > @@ -104,7 +104,8 @@ int efx_farch_test_registers(struct efx_nic *efx, > const struct efx_farch_register_test *regs, > size_t n_regs) > { > - unsigned address = 0, i, j; > + unsigned address = 0; > + int i, j; > efx_oword_t mask, imask, original, reg, buf; > > for (i = 0; i < n_regs; ++i) { >