From patchwork Mon Jan 25 17:07:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101098 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1479469lbb; Mon, 25 Jan 2016 09:08:36 -0800 (PST) X-Received: by 10.66.219.38 with SMTP id pl6mr27128557pac.147.1453741716744; Mon, 25 Jan 2016 09:08:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wl2si55420pab.236.2016.01.25.09.08.36; Mon, 25 Jan 2016 09:08:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757938AbcAYRIe (ORCPT + 30 others); Mon, 25 Jan 2016 12:08:34 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:55611 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757611AbcAYRIa (ORCPT ); Mon, 25 Jan 2016 12:08:30 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0MHYWy-1aOr5A2nxE-003Ke6; Mon, 25 Jan 2016 18:08:08 +0100 From: Arnd Bergmann To: Mark Brown Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Kuninori Morimoto , Brian Austin , Paul Handrigan , Liam Girdwood , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] ASoC: cs35l32: avoid uninitialized variable access Date: Mon, 25 Jan 2016 18:07:32 +0100 Message-Id: <1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FrSXPhruUPwwtc4= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, but by adding a check for IS_ENABLED(CONFIG_OF), we can let the compiler know as well, and also generate smaller object code. Signed-off-by: Arnd Bergmann --- sound/soc/codecs/cs35l32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.0 Reviewed-by: Krzysztof Kozlowski diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c index 44c30fe3e315..52ffaa8eb02b 100644 --- a/sound/soc/codecs/cs35l32.c +++ b/sound/soc/codecs/cs35l32.c @@ -372,7 +372,7 @@ static int cs35l32_i2c_probe(struct i2c_client *i2c_client, dev_err(&i2c_client->dev, "could not allocate pdata\n"); return -ENOMEM; } - if (i2c_client->dev.of_node) { + if (IS_ENABLED(CONFIG_OF) && i2c_client->dev.of_node) { ret = cs35l32_handle_of_data(i2c_client, &cs35l32->pdata); if (ret != 0)