From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Brown Subject: Re: [PATCH] ASoC: tlv320aic3x - fix variable may be used uninitialized warning Date: Wed, 24 Nov 2010 14:44:35 +0000 Message-ID: <20101124144434.GI24970@rakim.wolfsonmicro.main> References: <1290609659.2749.2.camel@phoenix> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from opensource2.wolfsonmicro.com (opensource.wolfsonmicro.com [80.75.67.52]) by alsa0.perex.cz (Postfix) with ESMTP id 1D0332417E for ; Wed, 24 Nov 2010 15:44:37 +0100 (CET) Content-Disposition: inline In-Reply-To: <1290609659.2749.2.camel@phoenix> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Axel Lin Cc: vbarinov@embeddedalley.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Liam Girdwood List-Id: alsa-devel@alsa-project.org On Wed, Nov 24, 2010 at 10:40:59PM +0800, Axel Lin wrote: > If aic3x_read failed , val is used uninitialized. > Fix it by initializing val to 0. > > This patch fixes below compile warning: > sound/soc/codecs/tlv320aic3x.c: In function 'aic3x_get_gpio': > sound/soc/codecs/tlv320aic3x.c:1183: warning: 'val' may be used uninitialized in this function > sound/soc/codecs/tlv320aic3x.c: In function 'aic3x_headset_detected': > sound/soc/codecs/tlv320aic3x.c:1211: warning: 'val' may be used uninitialized in this function > sound/soc/codecs/tlv320aic3x.c: In function 'aic3x_button_pressed': > sound/soc/codecs/tlv320aic3x.c:1219: warning: 'val' may be used uninitialized in this function This does rather look like a compiler bug. I'm generally against this sort of change as it just tramples over the warning in cases where it may be valid, though given the trivially small functions here it's hard to care. Really this stuff should all be written to use the standard jack and GPIO APIs anyway. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752272Ab0KXOoi (ORCPT ); Wed, 24 Nov 2010 09:44:38 -0500 Received: from opensource.wolfsonmicro.com ([80.75.67.52]:44954 "EHLO opensource2.wolfsonmicro.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751189Ab0KXOoh (ORCPT ); Wed, 24 Nov 2010 09:44:37 -0500 Date: Wed, 24 Nov 2010 14:44:35 +0000 From: Mark Brown To: Axel Lin Cc: linux-kernel@vger.kernel.org, Liam Girdwood , vbarinov@embeddedalley.com, alsa-devel@alsa-project.org Subject: Re: [PATCH] ASoC: tlv320aic3x - fix variable may be used uninitialized warning Message-ID: <20101124144434.GI24970@rakim.wolfsonmicro.main> References: <1290609659.2749.2.camel@phoenix> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1290609659.2749.2.camel@phoenix> X-Cookie: Made with real ingredients. User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 24, 2010 at 10:40:59PM +0800, Axel Lin wrote: > If aic3x_read failed , val is used uninitialized. > Fix it by initializing val to 0. > > This patch fixes below compile warning: > sound/soc/codecs/tlv320aic3x.c: In function 'aic3x_get_gpio': > sound/soc/codecs/tlv320aic3x.c:1183: warning: 'val' may be used uninitialized in this function > sound/soc/codecs/tlv320aic3x.c: In function 'aic3x_headset_detected': > sound/soc/codecs/tlv320aic3x.c:1211: warning: 'val' may be used uninitialized in this function > sound/soc/codecs/tlv320aic3x.c: In function 'aic3x_button_pressed': > sound/soc/codecs/tlv320aic3x.c:1219: warning: 'val' may be used uninitialized in this function This does rather look like a compiler bug. I'm generally against this sort of change as it just tramples over the warning in cases where it may be valid, though given the trivially small functions here it's hard to care. Really this stuff should all be written to use the standard jack and GPIO APIs anyway.