Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3376288ybp; Sun, 6 Oct 2019 10:34:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7Bkfg43D5TEJzk4roPGRa36xiJZWAhkKfV2LXcvsw6E/KSmtNmoST1ZALUXHAYuvRTBSB X-Received: by 2002:a17:906:7d10:: with SMTP id u16mr20662766ejo.194.1570383259972; Sun, 06 Oct 2019 10:34:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570383259; cv=none; d=google.com; s=arc-20160816; b=RuB5mNwn0C1d5qjaYJb70rI3444dLy3XWcIEdlzxqZUSOj1JPHVymXQBnCdVHJhBnR Owi3VRqu6+S6Luq8tifiqOuEjkLaHZ1NqKvT5W5WowTPn17aZWpydGbn+DFV6+y5Xps3 yoGmk+IYgwpiTn3E4wmNV4kTS7y/8NkZ3WjnDh/TlkT5xfXstV6vRN64g5li/6/RbdUT SCgw+Z+2B1gJ7gaS2MuO9Fp3QDAqX7e563U1NFbg9uANmbmvvpoo0J9q4nnd+PHJ+Ts0 HmqbUFIYCyKtM3/7Y2GBmcWukjibk2/Jqh+vvRQNJEh4g1HScEgkMyHOiC7t2ia2i9VZ 28Cw== 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=GJBW77nOnZMQfzp//Q8BxIUkIkNpgA0715u2cAE/dNc=; b=WxdavbBUSxfWDxeUG1lZNqR9QPUIMKCZt63erpoNg4dUObaYlwupBR2sD5n3ikKD08 Q2rk/HR5oY4fb1st5/LtK+mGMRdJxlkiGtiawKZT8go++r43yGl5jjDxdVTPLETx7Ljw LZbEmB0hpy4IadMeDzqe3MIz0mbAjZ2dUMMt/zOV6/Rd6YIvSpKIh87Rp1XxzacLTKZX 2qU1UsSklmaA/8Ej1cjh4LxWvzoNjKJTH3EVd8PC8AiHWHvjNfIVpQVNS2hTUvBJH6WC CY+T0UbR4IbkryWmEF4Os+5nSrZTPj82+G709kLSLfT+6eSelPORbf53HeGMo/4uRCUz Cmgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MTr95dv+; 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 s7si7574786edm.74.2019.10.06.10.33.56; Sun, 06 Oct 2019 10:34:19 -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=MTr95dv+; 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 S1729264AbfJFRai (ORCPT + 99 others); Sun, 6 Oct 2019 13:30:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:56526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728018AbfJFRag (ORCPT ); Sun, 6 Oct 2019 13:30:36 -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 E6DBF2087E; Sun, 6 Oct 2019 17:30:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570383035; bh=r0VppsRO05cODlZfjJkNWNlLDib6ImkdtE/4yky8mDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MTr95dv+viOkb2V5q6li7K9Qlome5l1VBC7zWcB1ZPvk7EpOzOlmkNYfE6kC/GmZ3 PKFh9TqhsUNW5aXCcf/j34CPZivxoex0+aT8u3RoniJ6cN3KjKBau5Pkk4hKSzsAXt GiR+gZYXNxlRLtpufR2jDr9V26CZLhP4eBNkcC8Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , Lorenzo Pieralisi , Andrew Murray , Shawn Guo , Sasha Levin Subject: [PATCH 4.19 062/106] PCI: histb: Propagate errors for optional regulators Date: Sun, 6 Oct 2019 19:21:08 +0200 Message-Id: <20191006171150.122985520@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 8f9e1641ba445437095411d9fda2324121110d5d ] 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. Signed-off-by: Thierry Reding Signed-off-by: Lorenzo Pieralisi Reviewed-by: Andrew Murray Cc: Shawn Guo Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pcie-histb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-histb.c b/drivers/pci/controller/dwc/pcie-histb.c index 7b32e619b959c..a3489839a8fc3 100644 --- a/drivers/pci/controller/dwc/pcie-histb.c +++ b/drivers/pci/controller/dwc/pcie-histb.c @@ -340,8 +340,8 @@ static int histb_pcie_probe(struct platform_device *pdev) hipcie->vpcie = devm_regulator_get_optional(dev, "vpcie"); if (IS_ERR(hipcie->vpcie)) { - if (PTR_ERR(hipcie->vpcie) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(hipcie->vpcie) != -ENODEV) + return PTR_ERR(hipcie->vpcie); hipcie->vpcie = NULL; } -- 2.20.1