From patchwork Thu Jan 2 22:05:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 234798 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 D54AFC3276E for ; Thu, 2 Jan 2020 22:13:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6F942253D for ; Thu, 2 Jan 2020 22:13:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003196; bh=bWieScTR+nkzZ01MDW5D8dk3AkB7khdSa4/5ypypEc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=bdFBMkN/3hToHNHq75GAa7yUIaMGIhVzIA/xfHmKvQfYY8FFJlmwfTJN57jDdtz/A XqoPZlrWr9YDjaMOcWsQMkkYV0CyAazXQszOrfEuXSzr5YZuUKv9k7gg5FCGc/UsmO Vt0tLe4m7ddMgpil+wqlxKU80n1AhHelC3vgW97Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727649AbgABWNP (ORCPT ); Thu, 2 Jan 2020 17:13:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:52862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727632AbgABWNO (ORCPT ); Thu, 2 Jan 2020 17:13:14 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B64F921835; Thu, 2 Jan 2020 22:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003194; bh=bWieScTR+nkzZ01MDW5D8dk3AkB7khdSa4/5ypypEc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2AWkWagYhhpk8FRPTIdIBYb+HVZTP4E2iOmnjbDw6YyKg6Yn24Qg8RVF0p5w3tkB7 x0MduW1yNNSIKofHM3aUvIdoiUaf5/z8ax6AKxEAV2j9XCtfXv04mj+1De2mwobPyG I6jc1ygchPgz9W+pl8V0FdqYjB7uYS27zwZW2DmA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Guido_G=C3=BCnther?= , Pavel Machek , Dan Murphy , Sasha Levin Subject: [PATCH 5.4 033/191] leds: lm3692x: Handle failure to probe the regulator Date: Thu, 2 Jan 2020 23:05:15 +0100 Message-Id: <20200102215833.543600929@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102215829.911231638@linuxfoundation.org> References: <20200102215829.911231638@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Guido Günther [ Upstream commit 396128d2ffcba6e1954cfdc9a89293ff79cbfd7c ] 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 Reviewed-by: Dan Murphy Signed-off-by: Pavel Machek Signed-off-by: Sasha Levin --- 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 3d381f2f73d0..1ac9a44570ee 100644 --- a/drivers/leds/leds-lm3692x.c +++ b/drivers/leds/leds-lm3692x.c @@ -334,9 +334,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) {