From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C9A3C04EBF for ; Mon, 23 Sep 2019 14:13:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 649FE20578 for ; Mon, 23 Sep 2019 14:13:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="Hgbv4v36" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407451AbfIWONV (ORCPT ); Mon, 23 Sep 2019 10:13:21 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:50728 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404847AbfIWONU (ORCPT ); Mon, 23 Sep 2019 10:13:20 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8NEDFYh074217; Mon, 23 Sep 2019 09:13:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569247996; bh=pylUPeCNtRYYZvjwR77bzHfG+zVG/7+gE+JoZOyPgmM=; h=Subject:To:References:From:Date:In-Reply-To; b=Hgbv4v36BP4W3UhGYlKUnVLDXwiAqEaYuizHFb2RbcmN8fb5t0hew/PgBEN4dpVUf MmFqV3ki2K+x/aZjJhgJbxCkb6xKig6A28L9495kXCOl2tjNMr33HK15/FLr+0y8rv NapSH1ZHlwYb73LCStx0KzPlbAjatWoQK6Hc4jCc= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8NEDF6T082043 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 23 Sep 2019 09:13:15 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 23 Sep 2019 09:13:10 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 23 Sep 2019 09:13:09 -0500 Received: from [10.250.65.13] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8NEDF8s092017; Mon, 23 Sep 2019 09:13:15 -0500 Subject: Re: [PATCH v3 3/5] leds: lm3692x: Handle failure to probe the regulator To: =?UTF-8?Q?Guido_G=c3=bcnther?= , Jacek Anaszewski , Pavel Machek , , References: <32fd08565f8dff39ce9a13f7b0a2546d22913b3a.1569100154.git.agx@sigxcpu.org> From: Dan Murphy Message-ID: Date: Mon, 23 Sep 2019 09:17:39 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <32fd08565f8dff39ce9a13f7b0a2546d22913b3a.1569100154.git.agx@sigxcpu.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Guido Thanks for the update Reviewed-by: Dan Murphy On 9/21/19 4:12 PM, Guido Günther wrote: > Instead use devm_regulator_get_optional since the regulator > is optional and check for errors. > > Signed-off-by: Guido Günther > Acked-by: Pavel Machek > --- > drivers/leds/leds-lm3692x.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c > index ad76e34455ff..54e9bd2d288b 100644 > --- a/drivers/leds/leds-lm3692x.c > +++ b/drivers/leds/leds-lm3692x.c > @@ -337,9 +337,18 @@ static int lm3692x_probe_dt(struct lm3692x_led *led) > return ret; > } > > - led->regulator = devm_regulator_get(&led->client->dev, "vled"); > - if (IS_ERR(led->regulator)) > + led->regulator = devm_regulator_get_optional(&led->client->dev, "vled"); > + if (IS_ERR(led->regulator)) { > + ret = PTR_ERR(led->regulator); > + if (ret != -ENODEV) { > + if (ret != -EPROBE_DEFER) > + dev_err(&led->client->dev, > + "Failed to get vled regulator: %d\n", > + ret); > + return ret; > + } > led->regulator = NULL; > + } > > child = device_get_next_child_node(&led->client->dev, child); > if (!child) {