From patchwork Fri Jan 1 23:19:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101213 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp4175575lbb; Fri, 1 Jan 2016 15:21:07 -0800 (PST) X-Received: by 10.98.64.9 with SMTP id n9mr54179146pfa.87.1451690466976; Fri, 01 Jan 2016 15:21:06 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16si43989403pfi.128.2016.01.01.15.21.06; Fri, 01 Jan 2016 15:21:06 -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 S1752688AbcAAXUc (ORCPT + 29 others); Fri, 1 Jan 2016 18:20:32 -0500 Received: from mout.kundenserver.de ([217.72.192.73]:51115 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752350AbcAAXU2 (ORCPT ); Fri, 1 Jan 2016 18:20:28 -0500 Received: from wuerfel.localnet ([134.3.118.24]) by mrelayeu.kundenserver.de (mreue102) with ESMTPSA (Nemesis) id 0MBke7-1aM3gK1PNv-00Al9n; Sat, 02 Jan 2016 00:19:55 +0100 From: Arnd Bergmann To: broonie@kernel.org Cc: Brian Austin , Paul Handrigan , Liam Girdwood , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] ASoC: cs35l32: avoid uninitialized variable access Date: Sat, 02 Jan 2016 00:19:52 +0100 Message-ID: <2884997.s8B8BuE04L@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:VhLKhsCOWRpf7g7b8Guj00rS+VM1I+jc3GayUV+9GOoOZG0+N6I vOKKZb/4bFsLBRNXh/2f3RU+eVfDae/sHgLt7tk2ovtwGNqdSfqRyyhc4Q1jML8aVJPYFbv +IOO3TyZctFZEwZyR4USu5nphXOjHNyYiTKmPvh67AesAiDRxTKPnRbX8Sd/yQ5mrtcNrCh jWdy3ZP1C1m05jFpAKU+A== X-UI-Out-Filterresults: notjunk:1; V01:K0:tY6858EgyKQ=:JKfziTrnGnmGs7zKl8wWxb U/Jqcg49bHHgwP8vlGQptWgscrF6RC3mFF89HhryaPcXtgJXYmC8G7E34DYd81g6ZWpkr0uJC 8H3GJr1riWVJb9mq95gneUBGFBVxcoEi4zRa41icHLyHvNqSiXkdpYuYVP0pfrJenBGr2m11W s5w9Su35pU8JavBcebqWYu/5b97GipkFHuLUz4e1oKHatck3aDAtuIdlh2CuHXkj82cEqSEXH RRXwnjPKtqYohXZwfXI/7+yKIDj+9gcwKNE4coDRWqJacrqcNNgFVifWBHT8ZnxDWJJYHrmbh vPTsuX09QvXN8dCQom2V7x5P6u3WBPg7INxw/BJzg1mCZq/QirfuKDQDj6I6tDC3u+OlYpYd0 VnUD9d8+fbWEqAPR3h5c7w8HIfbYdXfkBSn8EPe7O0GeTqTO2EOlk087eHVCnb/R5z2E4mhOB LceuiQAS9v+P9PysvSrLqkBWSv/o9vHyPuTIuNhtOng7H8rM1ZHdp9Gz5VSQf7X1XxbkkQgP0 JZ0An38m1DX1Eoe13IaXTUhVfMHdjg6guZZizT4n4iJIdmCe3GQmjUQ+9JEY2WPdTJ9hCxv81 46gNkvVFLOx48ZWEAMyTB1OnT7TvLXmifhf1J//ct3dVoaJheCLz86S+IzqY2+jVfd0z1X1K3 vBrZojNpyc0d7w/OVRGENYclyRwwLXFrSgTDzUuYIf36Yy2RofK5+L42D4IQEBoxNVeBttPPD YY4qMzKp1rfeHHdp 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ 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)