From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753211AbcGVALw (ORCPT ); Thu, 21 Jul 2016 20:11:52 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:17384 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752523AbcGVALs (ORCPT ); Thu, 21 Jul 2016 20:11:48 -0400 X-IBM-Helo: d23dlp03.au.ibm.com X-IBM-MailFrom: gwshan@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;netdev@vger.kernel.org Date: Fri, 22 Jul 2016 10:11:40 +1000 From: Gavin Shan To: Arnd Bergmann Cc: "David S. Miller" , Gavin Shan , Joel Stanley , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] net/ncsi: avoid maybe-uninitialized warning Reply-To: Gavin Shan References: <20160721192927.3182806-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160721192927.3182806-1-arnd@arndb.de> User-Agent: Mutt/1.5.23 (2014-03-12) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16072200-0040-0000-0000-000001C3682B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16072200-0041-0000-0000-00000A1CD870 Message-Id: <20160722001140.GA9305@gwshan> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-07-21_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607220001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 21, 2016 at 09:28:34PM +0200, Arnd Bergmann wrote: >gcc-4.9 and higher warn about the newly added NSCI code: > >net/ncsi/ncsi-manage.c: In function 'ncsi_process_next_channel': >net/ncsi/ncsi-manage.c:1003:2: error: 'old_state' may be used uninitialized in this function [-Werror=maybe-uninitialized] > >The warning is a false positive and therefore harmless, but it would be good to >avoid it anyway. I have determined that the barrier in the spin_unlock_irqsave() >is what confuses gcc to the point that it cannot track whether the variable >was unused or not. > >This rearranges the code in a way that makes it obvious to gcc that old_state >is always initialized at the time of use, functionally this should not >change anything. > >Signed-off-by: Arnd Bergmann Acked-by: Gavin Shan