Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966797AbcCPOF1 (ORCPT ); Wed, 16 Mar 2016 10:05:27 -0400 Received: from mx0a-0016ce01.pphosted.com ([67.231.148.157]:52706 "EHLO mx0b-0016ce01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966379AbcCPOFY convert rfc822-to-8bit (ORCPT ); Wed, 16 Mar 2016 10:05:24 -0400 From: Himanshu Madhani To: Arnd Bergmann , James Bottomley CC: Dept-Eng QLA2xxx Upstream , "Martin K. Petersen" , Nicholas Bellinger , Quinn Tran , Alexei Potashnik , Bart Van Assche , Swapnil Nagle , linux-scsi , linux-kernel Subject: Re: [PATCH] qla2xxx: avoid maybe_uninitialized warning Thread-Topic: [PATCH] qla2xxx: avoid maybe_uninitialized warning Thread-Index: AQHRfwNhLHWEXYBp2kGN3yfDCJnuDZ9bgFkAgAD+aoD//5zagA== Date: Wed, 16 Mar 2016 14:05:07 +0000 Message-ID: References: <1458078051-529344-1-git-send-email-arnd@arndb.de> <1458078554.2375.97.camel@linux.vnet.ibm.com> <2808565.5VeioJTJAb@wuerfel> In-Reply-To: <2808565.5VeioJTJAb@wuerfel> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.5.9.151119 x-originating-ip: [10.29.7.151] disclaimer: bypass Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5800 definitions=8105 signatures=670701 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1601100000 definitions=main-1603160197 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1186 Lines: 32 On 3/16/16, 5:59 AM, "Arnd Bergmann" wrote: >On Tuesday 15 March 2016 14:49:14 James Bottomley wrote: >> On Tue, 2016-03-15 at 22:40 +0100, Arnd Bergmann wrote: >> > >> > This slightly rearranges the code to move the second if() block >> > into the first one, to avoid the warning while retaining the >> > behavior of the code. >> >> I thought our usual policy was to ask someone to fix the compiler when >> it emitted a spurious warning. > >No, the rule is that we shouldn't blindly add initializations to >the variables when the compiler should have figured it out. > >In this case, I wouldn't expect the compiler to ever see through >the unlikely() macro, and I'm not adding a potentially counterproductive >initialization, so I see no reason not to apply the patch. I would like to keep unlikely() macro in the code. This patch looks good. Acked-By: Himanshu Madhani > >Making it easier for the compiler to figure out what is going >on should also lead to slightly better object code. If you think >my patch makes it less readable, an alternative would be to remove >the 'unlikely', which also gets rid of the warning. > > Arnd