Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3396829ybp; Sun, 6 Oct 2019 11:02:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyf3InzYONr/KbzfPVUBsvtIxs+hXmk4m1IT2kXkDE4xyeDPn4CEYMCeGoISORALQyiwBy X-Received: by 2002:aa7:dd8e:: with SMTP id g14mr25549107edv.233.1570384929073; Sun, 06 Oct 2019 11:02:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570384929; cv=none; d=google.com; s=arc-20160816; b=wJ86NW5Z2Z7gF6PahBXOLGXrWiA2SCZFJr5i16OosSxnU8wdcPrtxRAWpAgV9SG/Gh yr3dV3iYU0UEJhNhZ6zf7dmHF89aHJheatQzLz9m4sFbEBlgMz/K1YMVpnwDabTdb4z9 LjidMvbf26ErHyr+BaNZV2oIi687xryq0ZlLgIa7o/ENhnBP8Ong1z9PiPzxX+iiawZq bIQ2O/cJOPoQat4zvY85xicf07epy8f4MZ9JkyUkKpSYL97E5b+ocqDja6y2KkKeqD// uF3D7KMyuAyFnoalT2RiZ6gzIw/atPdfYWzKFA8HsMVBNHQgLqITm29FuMfjhSMFQm7p 6lJg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lm91fZLmJRjs9zAfMdUsEvYSsh28iqxuJbvNZ2xhtbo=; b=EsSMTe+S8Xj7SXrqXJhyPpJDxHCO4WSiqDLhz2ZmJ+xbYuB3L2jepVdZNgH+x2zW7V so7Ot5Y9Xq2CRFvh7XoEU81EC4Czb6mSwAfzO5Rmd3QnjbSNQ3auDKT2Ig6uhE9C5hu+ wXK3FtaipEqHdzUrefULd/LVysXwUpuvGZ0wPQc7mH6qRKqWZf9YJ6e4+KlxvjyfSS7V Jy2aZ9xtSldB5ofQHHwlGWNRxamxs7HacYyxZb5lqF3rMdB8xAOYfOVgl2Qu7DiRhx6j H6MD5QfuKa5QzVIjj7higwLMbpdVsR2he+3kAkUaza7kzGL5/4RDMtFkZw2tWOPGVxZ+ iweQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zC6vyocB; 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 p40si8343833eda.334.2019.10.06.11.01.45; Sun, 06 Oct 2019 11:02:09 -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; dkim=pass header.i=@kernel.org header.s=default header.b=zC6vyocB; 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 S1728758AbfJFR7a (ORCPT + 99 others); Sun, 6 Oct 2019 13:59:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:56460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729240AbfJFRad (ORCPT ); Sun, 6 Oct 2019 13:30:33 -0400 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 2937A2133F; Sun, 6 Oct 2019 17:30:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570383032; bh=BlvHyFvAAZGnC7hOjDp5jrec36iSCywnYRv27tgvF7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zC6vyocBNTQwUyjpr3JgLhgtXcvztFX6aeLZdrOFrCibNBePcgfAzWbBjgJ1W4Hwu 2disBdBkLtiPZCIxxq9fCS4xrGwEDV/xzZMiEUS98qDfy6IUsGAflGQAwf9HNPcRGF m310Mi3QndLOVjDdr5XZ4SyFX4lxTgt8JcoGpb70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Stuebner , Thierry Reding , Lorenzo Pieralisi , Andrew Murray , Shawn Lin , linux-rockchip@lists.infradead.org, Sasha Levin Subject: [PATCH 4.19 061/106] PCI: rockchip: Propagate errors for optional regulators Date: Sun, 6 Oct 2019 19:21:07 +0200 Message-Id: <20191006171149.476262829@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191006171124.641144086@linuxfoundation.org> References: <20191006171124.641144086@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Thierry Reding [ Upstream commit 0e3ff0ac5f71bdb6be2a698de0ed0c7e6e738269 ] regulator_get_optional() can fail for a number of reasons besides probe deferral. It can for example return -ENOMEM if it runs out of memory as it tries to allocate data structures. Propagating only -EPROBE_DEFER is problematic because it results in these legitimately fatal errors being treated as "regulator not specified in DT". What we really want is to ignore the optional regulators only if they have not been specified in DT. regulator_get_optional() returns -ENODEV in this case, so that's the special case that we need to handle. So we propagate all errors, except -ENODEV, so that real failures will still cause the driver to fail probe. Tested-by: Heiko Stuebner Signed-off-by: Thierry Reding Signed-off-by: Lorenzo Pieralisi Reviewed-by: Andrew Murray Reviewed-by: Heiko Stuebner Acked-by: Shawn Lin Cc: Shawn Lin Cc: Heiko Stuebner Cc: linux-rockchip@lists.infradead.org Signed-off-by: Sasha Levin --- drivers/pci/controller/pcie-rockchip-host.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c index 1372d270764f9..5ce8e63756875 100644 --- a/drivers/pci/controller/pcie-rockchip-host.c +++ b/drivers/pci/controller/pcie-rockchip-host.c @@ -608,29 +608,29 @@ static int rockchip_pcie_parse_host_dt(struct rockchip_pcie *rockchip) rockchip->vpcie12v = devm_regulator_get_optional(dev, "vpcie12v"); if (IS_ERR(rockchip->vpcie12v)) { - if (PTR_ERR(rockchip->vpcie12v) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(rockchip->vpcie12v) != -ENODEV) + return PTR_ERR(rockchip->vpcie12v); dev_info(dev, "no vpcie12v regulator found\n"); } rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3"); if (IS_ERR(rockchip->vpcie3v3)) { - if (PTR_ERR(rockchip->vpcie3v3) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(rockchip->vpcie3v3) != -ENODEV) + return PTR_ERR(rockchip->vpcie3v3); dev_info(dev, "no vpcie3v3 regulator found\n"); } rockchip->vpcie1v8 = devm_regulator_get_optional(dev, "vpcie1v8"); if (IS_ERR(rockchip->vpcie1v8)) { - if (PTR_ERR(rockchip->vpcie1v8) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(rockchip->vpcie1v8) != -ENODEV) + return PTR_ERR(rockchip->vpcie1v8); dev_info(dev, "no vpcie1v8 regulator found\n"); } rockchip->vpcie0v9 = devm_regulator_get_optional(dev, "vpcie0v9"); if (IS_ERR(rockchip->vpcie0v9)) { - if (PTR_ERR(rockchip->vpcie0v9) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(rockchip->vpcie0v9) != -ENODEV) + return PTR_ERR(rockchip->vpcie0v9); dev_info(dev, "no vpcie0v9 regulator found\n"); } -- 2.20.1