From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934423AbcAZMEs (ORCPT ); Tue, 26 Jan 2016 07:04:48 -0500 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:47115 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934375AbcAZMEr (ORCPT ); Tue, 26 Jan 2016 07:04:47 -0500 Date: Tue, 26 Jan 2016 12:04:32 +0000 From: Mark Brown To: Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org, Liam Girdwood , linux-kernel@vger.kernel.org Message-ID: <20160126120432.GF6588@sirena.org.uk> References: <1453737537-1960121-1-git-send-email-arnd@arndb.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jwo+Eyhr8WyUBZhS" Content-Disposition: inline In-Reply-To: <1453737537-1960121-1-git-send-email-arnd@arndb.de> X-Cookie: APL hackers do it in the quad. User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: 2a01:348:6:8808:fab::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH] regulator: return NULL for dummy bulk_get operation X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --jwo+Eyhr8WyUBZhS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jan 25, 2016 at 04:58:50PM +0100, Arnd Bergmann wrote: > 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] The usage in that driver looks a bit dodgy - the disable function is just an open coding of regulator_bulk_disable() with no error checking while the enable function is doing a series of set_voltage() calls on every enable which look a lot like values that I'd expect to come from constraints rather than being set explicitly (the VDD values are an API abuse we know about in the Qualcomm drivers). The fact that it never varies the voltage is a warning sign that the driver might not want to be using set_voltage() at all, and it should at least do that once on init if there's a use case. A quick glance at in tree DTs suggests that there's no actual runtime variation. I'm not 100% convinced this didn't actually warn us about a real problem. --jwo+Eyhr8WyUBZhS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWp2DPAAoJECTWi3JdVIfQuecH/j+IoZgYliH7RQCry8yynj2g Zqlg5Glh8vibuE6NAh4uBixb/MULn8mZgoQofOtb7XBtMfn1Ci7J/TNJphMxpGQR Gs9Ek62g4c86N3JE8yv4b5hCNzs/iNkOmT7eSf3eXc9Q1/0e2lQCm8VIc8sODieK InqX4GWugiCAMLBe/y7I9F9XH5d6KbhRexb/CbE6zCLTT+VN3yX46CWNuX35/N7L +pRA9lwWuBc4NK2T4X2aKeZTmuMS90Z+pR2VAzPBbN+L+bQ20IBbNuCuPW6PeGRr Dq/ChEPJnZWuB592k007j7R6qAyhFqEvkWGdI/BQx25Cya5gH+ePgCa/Sz/QB40= =J9Qa -----END PGP SIGNATURE----- --jwo+Eyhr8WyUBZhS--