Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755084AbeAOJSe (ORCPT + 1 other); Mon, 15 Jan 2018 04:18:34 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:42092 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754777AbeAOJSc (ORCPT ); Mon, 15 Jan 2018 04:18:32 -0500 Date: Mon, 15 Jan 2018 10:18:21 +0100 From: Maxime Ripard To: Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, Daniel Vetter , Mark Brown , linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/panel: lvds: Handle the optional regulator case properly Message-ID: <20180115091821.wwg73p6q67k4ey4p@flea.lan> References: <20180110155941.16109-1-maxime.ripard@free-electrons.com> <20180111131256.bmr6qbgzcmyfg4mj@flea.lan> <1579517.s7hJ1SlSuH@avalon> <5140293.enj6JbCqAe@avalon> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bufj3g6aevsrqaw3" Content-Disposition: inline In-Reply-To: <5140293.enj6JbCqAe@avalon> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: --bufj3g6aevsrqaw3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 12, 2018 at 12:09:39AM +0200, Laurent Pinchart wrote: > Hi Maxime, >=20 > On Friday, 12 January 2018 00:06:06 EET Laurent Pinchart wrote: > > On Thursday, 11 January 2018 15:12:56 EET Maxime Ripard wrote: > > > On Thu, Jan 11, 2018 at 03:05:01PM +0200, Laurent Pinchart wrote: > > >> On Wednesday, 10 January 2018 17:59:41 EET Maxime Ripard wrote: > > >>> The devm_regulator_get_optional function, unlike it was assumed in = the > > >>> commit a1c55bccf600 ("drm/panel: lvds: Add support for the power-su= pply > > >>> property"), is actually returning an error pointer with -ENODEV ins= tead > > >>> of NULL when there's no regulator to find. > > >>>=20 > > >>> Make sure we handle that case properly. > > >>>=20 > > >>> Fixes: a1c55bccf600 ("drm/panel: lvds: Add support for the power-su= pply > > >>> property") Signed-off-by: Maxime Ripard > > >>> > > >>> --- > > >>>=20 > > >>> drivers/gpu/drm/panel/panel-lvds.c | 9 +++++++-- > > >>> 1 file changed, 7 insertions(+), 2 deletions(-) > > >>>=20 > > >>> diff --git a/drivers/gpu/drm/panel/panel-lvds.c > > >>> b/drivers/gpu/drm/panel/panel-lvds.c index 57e38a9e7ab4..9f46e7095c= 0e > > >>> 100644 > > >>> --- a/drivers/gpu/drm/panel/panel-lvds.c > > >>> +++ b/drivers/gpu/drm/panel/panel-lvds.c > > >>> @@ -215,8 +215,13 @@ static int panel_lvds_probe(struct platform_de= vice > > >>> *pdev) > > >>> lvds->supply =3D devm_regulator_get_optional(lvds->dev, "power"); > > >>> if (IS_ERR(lvds->supply)) { > > >>> ret =3D PTR_ERR(lvds->supply); > > >>> - dev_err(lvds->dev, "failed to request regulator: %d\n", ret); > > >>> - return ret; > > >>> + > > >>> + if (ret !=3D -ENODEV) { > > >>> + dev_err(lvds->dev, "failed to request regulator: %d\n", ret); > > >>> + return ret; > > >>=20 > > >> I wouldn't print an error message if ret =3D=3D -EPROBE_DEFER. > > >>=20 > > >>> + } else { > > >>> + lvds->supply =3D NULL; > > >>> + } > > >>> } > > >>=20 > > >> How about > > >>=20 > > >> lvds->supply =3D devm_regulator_get_optional(lvds->dev, "power"); > > >> if (IS_ERR(lvds->supply)) { > > >> ret =3D PTR_ERR(lvds->supply); > > >> if (ret !=3D -ENODEV) { > > >> if (ret =3D=3D -EPROBE_DEFER) > > >=20 > > > I guess that would be !=3D -EPROBE_DEFER > >=20 > > Of course, my bad. > >=20 > > >> dev_err(lvds->dev, "failed to request regulator: %d\n", ret); > > >> return ret; > > >> } > > >> =09 > > >> lvds->supply =3D NULL; > > >> } > > >=20 > > > Otherwise, it works for me. >=20 > With the above change, >=20 > Reviewed-by: Laurent Pinchart > Tested-by: Laurent Pinchart Applied to drm-misc-next-fixes. Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com --bufj3g6aevsrqaw3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE0VqZU19dR2zEVaqr0rTAlCFNr3QFAlpccdwACgkQ0rTAlCFN r3RapQ/9FB5AzalAxUtqobvK/xjuBgNQOI6G6I1IQuB5KI8g2Ak5/g5Tl3C8XqVj AeP+xiR7WzJQeNt2I0RxbDHfCsIBnC6PQLcjyDPncERupGorMDrEHtQ+KK0Rg5cp hcr4Ks8GrgGfNiY7a1mSF6l11l8hjKPkA/6gxy+tZKz2QVY3JlFHKjTJDCzmdyCV XfuiPCTGLMJGeoY2VsJ/ZsQCOx9Wh9p+7e2hozHsABGJmEIN0b15D5tG2il5s26K J4F5H/BUaJLrMA3neJaa/DBDUoqgsUEtpLZ0J2kMxXFP7FOIJJc+22OnweK1EWZQ aHJ4T0D47DLHXeUFDLKAHTiwcmpVOUfUaX61Nf6gJ6jyif5Z6h6tufU7/Y64VXLX PNeCeWPjPbSGqrDpYNkpp18p9ZcGFf+Gg1IZce+3GwM7XcVZcCOEoXsUNcrUUb3q vRzbH3Rf9uUeKtVI3bQgyoZ7OE6rHuMZAUq3TTcF9UaL2l0owcOclNzCmhAR4luU rgd1ZmU6TUtG6oi+VNrAi+OpzjNIji2W4pp+e7PrCRCapX5go/kBW9FcPekHLlWT EB/LQF6e6MT5DCowMFvjoY4CHl2/z/25ZhwNB5j4YM31XIseQn3Km3KWUzOfliOk fUeOOiX1xueszpyQPx353S3e/L1UXxA7RCdQgme2lSIAa0/tWE0= =FgZ+ -----END PGP SIGNATURE----- --bufj3g6aevsrqaw3--