From patchwork Mon Jan 25 15:58:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101112 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp1440525lbb; Mon, 25 Jan 2016 07:59:45 -0800 (PST) X-Received: by 10.66.140.79 with SMTP id re15mr26113101pab.127.1453737585797; Mon, 25 Jan 2016 07:59:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 63si34504464pft.41.2016.01.25.07.59.45; Mon, 25 Jan 2016 07:59:45 -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 S933320AbcAYP7o (ORCPT + 30 others); Mon, 25 Jan 2016 10:59:44 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:62992 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932903AbcAYP7i (ORCPT ); Mon, 25 Jan 2016 10:59:38 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue005) with ESMTPA (Nemesis) id 0Ldqml-1ZfdIb2Blb-00j5fg; Mon, 25 Jan 2016 16:59:02 +0100 From: Arnd Bergmann To: Mark Brown Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Liam Girdwood , linux-kernel@vger.kernel.org Subject: [PATCH] regulator: return NULL for dummy bulk_get operation Date: Mon, 25 Jan 2016 16:58:50 +0100 Message-Id: <1453737537-1960121-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:RLWk6kxTyr+or/+DNpO+pu01w57PNrJ9odAqokT5GgmKdXa+OuB FMW04RUq/qJtJykjhJIacGKmzdkBJgCT9OyZRmSGxZB4mHQl6lkh4stbBRcq5+bE7EkgPpF 7xlJVR1Yg9zd1zB9wGtcNN1Lu5vBJYuujpPkkQim5hI3qqFhqIQkAbmr7uhy5N/bwFlGW4g 5mWzSo/l4kpnIdeao4wcQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:6mBpzyFaJdc=:L9EIj+qfLizar+kGFyK6vb v3aHIvqEF18322mzugM67OedU2FWxe0DRa27C8WrQiRw/ItORzBDIEKPhwB65O6FQSfA77PTx VXlfEqY5vSuhdIs3BFYv2RMYOiTcvQHhjkHGxP/RBzdPKyqPdCL/VYJeeFxbzSsr2cgHNqG1C O/Whtoc/ryQ98sHU1vrbpZzTJskecwAQvkZnQp8xp3ifzAr3n6SUy+/88dsAdHfrzj/SwpNWG a38h0fWg2aDLliHjSCteFIwirhHOI4SI/z0EXG6g0kSIQ6ESe4d+6yron8mdKAL4eNhoLx0f6 TCSVPGqcKaa5H5umERC/LVF3nKNreWShuJYdi0j5gQPGfysWAeVjbj8WplycvPhkB82GJ+mL0 1JFNQX2muzXhu9iqtgvNAyrvFh8o8QvxOGRg+JQLKO6agQI3LTObFj9DGs+RsxHhzlAaEufIQ +p3zyMzPrM6h1hv3haiRgr0+Tu67lsllHXpThnpML3AMvQ5LW2d2r0xiFiCapI/rxdWkd6KT4 wRvwnQ1LcGWCeeUM93w5+LFr/dv4lXv06dFfZyfgm9EOIxwa3g0TWj2tOvenyMvsWNDm91mGX egELJZA/f0dv3UWC5vRjc8cWT5Jm54hjiQQA04kDkVN6ON8WxclaUyXCSFG2I8F+LxLAWwKxU G/6vcwDY2whUhh4+cuvR5M02b9J6ZBjkfAgCGXSs3gVF+M9ksoX5I93s8vnRmOJSaErA= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drivers that call regulator_bulk_get or devm_regulator_bulk_get when CONFIG_REGULATOR is disabled see the function return successfully, but cannot use the "consumer" pointers that are meant to be returned from the functions, as the values are uninitialized. Gcc warns about this: drivers/usb/phy/phy-qcom-8x16-usb.c: In function 'phy_8x16_probe': drivers/usb/phy/phy-qcom-8x16-usb.c:284:13: error: 'regs[0].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/usb/phy/phy-qcom-8x16-usb.c:285:13: error: 'regs[1].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/usb/phy/phy-qcom-8x16-usb.c:286:12: error: 'regs[2].consumer' may be used uninitialized in this function [-Werror=maybe-uninitialized] To make the code behave in a reproducible way, this changes the two dummy function to behave like the non-bulk regulator_get and devm_regulator_get functions to, returning a NULL pointer with a successful return code. This also gets rid of the warnings. Signed-off-by: Arnd Bergmann --- include/linux/regulator/consumer.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.7.0 diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 48603506f8de..f4774bf707c2 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -404,13 +404,17 @@ static inline int regulator_bulk_get(struct device *dev, int num_consumers, struct regulator_bulk_data *consumers) { + int i; + for (i=0; i < num_consumers; i++) + consumers[i].consumer = NULL; + return 0; } static inline int devm_regulator_bulk_get(struct device *dev, int num_consumers, struct regulator_bulk_data *consumers) { - return 0; + return regulator_bulk_get(dev, num_consumers, consumers); } static inline int regulator_bulk_enable(int num_consumers,