Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965706AbcCNO57 (ORCPT ); Mon, 14 Mar 2016 10:57:59 -0400 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:49611 "EHLO mx0a-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965653AbcCNO5y (ORCPT ); Mon, 14 Mar 2016 10:57:54 -0400 Authentication-Results: ppops.net; spf=pass smtp.mail=Brian.Austin@cirrus.com Date: Mon, 14 Mar 2016 10:03:00 -0500 From: Brian Austin X-X-Sender: heelrod@heelroid To: Arnd Bergmann CC: Mark Brown , Brian Austin , Paul Handrigan , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Axel Lin , , Subject: Re: [PATCH v3] ASoC: cs35l32: avoid uninitialized variable access In-Reply-To: <1457967019-3901380-1-git-send-email-arnd@arndb.de> Message-ID: References: <1457967019-3901380-1-git-send-email-arnd@arndb.de> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 include:spf-001ae601.pphosted.com ip4:141.131.128.20 ip4:141.131.3.20 ip4:213.128.236.230 ip4:87.246.98.25 ip4:87.246.78.26 -all X-Proofpoint-Spam-Details: rule=notspam policy=default 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-1601100000 definitions=main-1603140212 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1340 Lines: 32 On Mon, 14 Mar 2016, Arnd Bergmann wrote: > gcc warns about the possibilty of accessing a property read from > devicetree in cs35l32_i2c_probe() when it has not been initialized > because CONFIG_OF is disabled: > > sound/soc/codecs/cs35l32.c: In function 'cs35l32_i2c_probe': > sound/soc/codecs/cs35l32.c:278:2: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized] > > The code is actually correct because it checks the dev->of_node > variable first and we know this is NULL here when CONFIG_OF > is disabled, but Russell King noticed that it's broken when > we probe the device using DT, and the properties are absent. > > The code already has some checking for incorrect values, and > I keep that checking unchanged here, but add an additional > check for an error returned by the property accessor functions > that now gets handled the same way as incorrect data in the > properties. > > Signed-off-by: Arnd Bergmann > --- > v3: Restore a line that was accidentally removed, as pointed > out by Brian Austin. > v2: fix bug in case of CONFIG_OF and missing properties > v1: only address warning for the !CONFIG_OF case > > sound/soc/codecs/cs35l32.c | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) Acked-by: Brian Austin Thanks