Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2739733ybj; Mon, 23 Sep 2019 08:38:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2fsc6KZmbJNjse5VDwWUIDMpd21f5ACRg2lr20+0nwpWhJljHtPDQrj6ol78fPBc7iDnT X-Received: by 2002:aa7:d995:: with SMTP id u21mr685810eds.271.1569253125952; Mon, 23 Sep 2019 08:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569253125; cv=none; d=google.com; s=arc-20160816; b=jZaQNCeHSRgpEgTFiN3z76d6mGL21E1vTbKbWlutg+RYbZd9jzzfWbKgFtv9+C8x90 WzlcJSGZslXd0zrWbS6lU/FWJUzVoY60Sp2ogPkuW9D42orN07/jiXKt8co1lFbpOys7 tVmMMHKJS4jD+KL6RjwtPj4/v/fm4+XpeHuQixDNqQDAWpB8hid7PCJ7f2sme0hXv7kB VzVXpBMIez/oteTPwftgmOKYGiRqm1iBXsKEutrzjBim+tPPIRFZtBZmIdSbdHaNNmiO US0XoXcw+iWTEy2lRVFL0gs8JPiIajSnfuK5Kurov6nEMkyqflYxPa2+m7n/TNXgxWtY mObQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=zNi7PAC7p9RBSZwGt+cdzQjKTXpd/kFUwUXmYOJB4Jo=; b=kDCR17RWgd9C7wsRRxHmqWne92Oa5H13KpJa9U/QUKjfQQypC7Ua0ua8qfOzMW59QM Vh+Y4sQHHMB+UMOVjRNL6HqvkJJrBANRcZXLUTcqbiolrT8b/ilbk4F/rpF+Kg1TXyZh KZU52bg0DQlgWNmnLrz/5kdrCq8W3bjTXGwGf8MqxRKZxQdT4SIBtwdpgoEaJ+/SGCEo 7aYGlSUtSPvZIWrJK9ZptTfb0oPmkzIeNFkCgPmTs4xmTbmG9CWPDACW+VTw1QIpnqY1 18jqaKQ41VXSFRyEL8bEdx8ubMR4EWavfS84pyupxufV4sCGQ6pNGrcXodFEsqU54ZAF hFzw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w26si5328518ejb.6.2019.09.23.08.38.19; Mon, 23 Sep 2019 08:38:45 -0700 (PDT) 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 S1728151AbfIVKY2 (ORCPT + 99 others); Sun, 22 Sep 2019 06:24:28 -0400 Received: from honk.sigxcpu.org ([24.134.29.49]:36200 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbfIVKY1 (ORCPT ); Sun, 22 Sep 2019 06:24:27 -0400 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 6A804FB08; Sun, 22 Sep 2019 12:24:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wdARc2jl3Cpr; Sun, 22 Sep 2019 12:24:24 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id D112248664; Sat, 21 Sep 2019 14:12:12 -0700 (PDT) From: =?UTF-8?q?Guido=20G=C3=BCnther?= To: Jacek Anaszewski , Pavel Machek , Dan Murphy , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/5] leds: lm3692x: Handle failure to probe the regulator Date: Sat, 21 Sep 2019 14:12:10 -0700 Message-Id: <32fd08565f8dff39ce9a13f7b0a2546d22913b3a.1569100154.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.23.0.rc1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) { -- 2.23.0.rc1