From patchwork Mon Mar 4 20:03:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159591 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4157139jad; Mon, 4 Mar 2019 12:03:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxNwFgituYIDv6Jx3dJxaoSqJgb028fjks+h5ccPks0oww3d5Gk2rYsvGRHKYcWo41UyBvx X-Received: by 2002:a65:510c:: with SMTP id f12mr20482397pgq.40.1551729826386; Mon, 04 Mar 2019 12:03:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551729826; cv=none; d=google.com; s=arc-20160816; b=JFMICGpxLXVgIchtDiRvlUUtQKP+NeARUDkV6F/p7ZzspqjvJDk1gKtHq+OnvHtCqT lqtExIvBa4N1z19gnkneJi/ZJlHqbYS1Up1ufYojb6Uog+uac2tE+BXlHNFW+I6zJAc3 2AAuhQ7tq0U9aeLh4Y0TgAf7Wh6+7iES3s/fu7XgMyVI8cow3SYVaXhWdrzAJpTz3hA4 WeKlx8ALJN44kxa04GrbuMylB+LUamvuA2IqqzWSjaVJjv9teduQvkZNtQ8cgAZgk0/K sIkA8k6NxIBOnwHyyD9BPuLizu9YGsTlN+2+LCC0CMssDcVkRT26ZzA36QlT1mfRw3kE I5tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=3qDlIpGtFLoh8M8m9di0UHsZq4pXeObH2xAwkE41qvA=; b=W0XSaB2QoRCnBkVGuO0ewPIMvTQHcP8MB6VZ7qNZfEnv894JiFKOJTLDRVTxnLcC6D I3acidaPVzVriT+7y1o4CQLpgYkFRI0Y5n9yiZYdW4S3tng639QvFOtL+cHrzZmvlDvm dw8p2svfFj7XCLYA/GLYOKH6yKTTNad4cCeJH22Yd3mhVYVYWBDa/tztnH9ifsVmTWQT Sksfqf1JjSR0537Aw0JoNhnZSsAlK0vE1M/tLcqHPubdeQzSMq1/9vA+3YBB4QYaL3NM wMCt7Mss03yYRil18eZE0rM2s8QHmSLDc7+44g6c4shQ9B7ujWQFy5QXDJ4MKjXhuXbX qRrQ== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g32si5816179pgg.223.2019.03.04.12.03.46; Mon, 04 Mar 2019 12:03:46 -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 S1726477AbfCDUDo (ORCPT + 31 others); Mon, 4 Mar 2019 15:03:44 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:52945 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726066AbfCDUDl (ORCPT ); Mon, 4 Mar 2019 15:03:41 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MFKbB-1glHpP2plR-00FgVC; Mon, 04 Mar 2019 21:03:18 +0100 From: Arnd Bergmann To: Andy Gross , David Brown , Jonathan Cameron Cc: Arnd Bergmann , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: adc: fix uninitialized variable warning Date: Mon, 4 Mar 2019 21:03:07 +0100 Message-Id: <20190304200317.1229196-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:dKyJTi6zwvLIK6HWRwyR2h8jCFc+6JgkVrmI6oCJE+Zv3s6Bw1W 6BgDkjUaHWD40RaOBGd5MwMa8hOL131etmqlz7VRGWesmueGDx1ta0cmTEiGCE8XEXJWK7U BJDZtvfzEZE/rckNNlAci6kqHj5khzi4r0Gw0Iag6OFNnF0vfURjF39duyR5hTiZOvnNf+0 9Px2loGkdKeeoIt9ZYoaQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:kn8eG3ON4tA=:E3xXcuWYg6ajevejuU4S2i KIh5gegm6VK3vj49J4KUrZMJ/3++YCiw1WZQ59r3oOvOjlnCAcHlVGOI8wYzMVdnBQ48sZxu0 Zdq16Swx1Vg8QY5NdRIBlwunOMooQaAIuq60v1gFqI7IxcSmYiRspWw1a18nm8UPaw+fh5b42 Uj/c+mVtvHEOm9Z7nDYA0qsG6iOqocl5pxasJ5JE50zfobEbklUsgm3iN67JSlb3F95Y9EHog cTDnso/hKlshEHwPGb2Nqiasl6tiUKrHpe5fNaUxodRt49RbI1A2V9sQgGxQ5Ka+5dES3OTZn Mq67Vg9BLfr90yxwlNDIFk5WmPET1rELhCfQ9r+aPXb9k0ruXiVPLZLD+ArInck9sH4gX6pHN dUon9JYGTKL6Z5ZOL1cITMd/Y4acQyLLo6YpCHVXNY6rF7tDUYYeCoxhr9o+TSKx+yJX5dFg5 1/gfGyV2ZhjBKqAtabY8Xx4PqYsjnYt8e7ODpQhyEqg3xuuargLvM7tnJRpDsQnjOXI/arx84 pqF8g0k45GYaNwnm/DBel9D3+AhgbciHa44hQeQDddqMRGFjKus3NLqGou7Ki0ziRxs1W933S 0q2PxZE5FnmXMtnYrcx9FVN10/6mM+wY1/Awk+l1VkuUwncVAEAoXqksh/5soYVphSHMCgp8p WeR2tRTLEIkhquL26Ogn6w3PwJN6PmgJSZNkurcxbA4YR9D9obLOwAcsm/EK9Hl/LAZ94VprZ QsLvmVVgXtxf3HvRh/S12i0RQJRZYqOV2sF+Pg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The pm8xxx_xoadc_probe() function triggers a bogus warning about an uninitialized variable: drivers/iio/adc/qcom-pm8xxx-xoadc.c: In function 'pm8xxx_xoadc_probe': drivers/iio/adc/qcom-pm8xxx-xoadc.c:633:8: error: 'ch' may be used uninitialized in this function [-Werror=maybe-uninitialized] Reword the function so the compiler can see more easily that it is always initialized. Fixes: 63c3ecd946d4 ("iio: adc: add a driver for Qualcomm PM8xxx HK/XOADC") Signed-off-by: Arnd Bergmann --- drivers/iio/adc/qcom-pm8xxx-xoadc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.20.0 diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c index c30c002f1fef..7939238001c8 100644 --- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c +++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c @@ -423,7 +423,7 @@ static irqreturn_t pm8xxx_eoc_irq(int irq, void *d) static struct pm8xxx_chan_info * pm8xxx_get_channel(struct pm8xxx_xoadc *adc, u8 chan) { - struct pm8xxx_chan_info *ch; + struct pm8xxx_chan_info *ch = NULL; int i; for (i = 0; i < adc->nchans; i++) { @@ -431,8 +431,6 @@ pm8xxx_get_channel(struct pm8xxx_xoadc *adc, u8 chan) if (ch->hwchan->amux_channel == chan) break; } - if (i == adc->nchans) - return NULL; return ch; }