Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1394360ybj; Fri, 20 Sep 2019 09:44:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFqbI0qhmt6vPBgmPaBIORfdDlZlK5ORM/gUSzI6QxbyRGn4Z258UTyvkabX/9lYPzF2Xl X-Received: by 2002:a50:9e0a:: with SMTP id z10mr8192334ede.202.1568997895864; Fri, 20 Sep 2019 09:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568997895; cv=none; d=google.com; s=arc-20160816; b=PillZ/0vczW2ANUJqeq1vz6eXv9dUWcHkLDxONn1Q9vefjw8PzxCThpSFREX1b/s4D PBRCicrJVBFrTmHFoHaS8lJETrHCxN8OXTz+1HJxPisEy/nnPRFLoUHLNackNQAKr1E/ /3pxkovFE6Xn5O0kiTcTb2Fu2PttcSBJ5BYkYGVWOmBncu3nY66u6FEmU+bww2B7g4e1 9WlB3OZbkc/LGoJTjAod8XyF56Rv8WCXy/l0PVkIKbg3KsuO1wQArMJdlRLvupxUN9gb bR8Ccp2eC2Gos5qyimGExQ7SAgJ3N8SZ745x4yqyxCTURMTtyCV52ffEZzboDGpU+Bcl Ghnw== 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=ogomQQvDn0TsCfPp28GF4rrXFGbjnpPIdXZDXxT8e+M=; b=uQC+9GjktUWreCVfgN6jV/Q0N32SJL2t9QvY7MOrYHYmNENn/17kiwNR+0MiXF43bB idl6o32cCiu/OzF8wRUgRagVAtKWQnhkijP731/orC1iTUU9QdjkGE3s51Ygrbg7+xam aMWbJSz9+7zga4N3deCSjA3AEc99c9iKWNmveqoZnsL2HvRo5EAABqfj7OrBFfQNe14c 6/Ngq/vsISK0qpT0Bg/k4VARcPVR0PLfdRyfcGALQZ/ROGntrsL5fok+1lsVejfX0D5b 9un+JCv6YTOCQ/USdbWN3TL6K7pL/9XCe+rBIUhCn/5J5iTYzoOW0Qq1nW+w/Rh4e9Op rTZQ== 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 f5si1581734edx.302.2019.09.20.09.44.32; Fri, 20 Sep 2019 09:44:55 -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 S2408084AbfITF1O (ORCPT + 99 others); Fri, 20 Sep 2019 01:27:14 -0400 Received: from honk.sigxcpu.org ([24.134.29.49]:39708 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392287AbfITF1O (ORCPT ); Fri, 20 Sep 2019 01:27:14 -0400 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 28ED8FB02; Fri, 20 Sep 2019 07:27:12 +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 7LGiFDFAHeGf; Fri, 20 Sep 2019 07:27:11 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id D8DC348847; Thu, 19 Sep 2019 22:27:07 -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 v2 3/5] leds: lm3692x: Handle failure to probe the regulator Date: Thu, 19 Sep 2019 22:27:05 -0700 Message-Id: <6f980a7d8acec4d33bcc78a11f5ce4ee392e7c05.1568957104.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 31115655f97b..6f6a17ec7c9f 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