Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp3376308ybp; Sun, 6 Oct 2019 10:34:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYJ4HE7TbHrsFL8+E12SVh+B4pUsS2VEpSD+0lWF9yJmy6g8g5F7gmN1ixtWqAXmOkqPWK X-Received: by 2002:a50:d758:: with SMTP id i24mr25130155edj.246.1570383261527; Sun, 06 Oct 2019 10:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570383261; cv=none; d=google.com; s=arc-20160816; b=smQKF3Yh0wBwxYosoiAtMaazyyJwkcbA7u77WmyS9cgaxILKmqxvGB+elFdTmYAexj 3Jb2LIrX9tW0jZUmxstZmkBT64S/IQGwYJbgcIRF1p0yX3kaOHdITCqp+mTRXfcCAeY2 r7FWYP91VqPd2q+O0kx7v3pUQMOP91G347UQ+wuoQ7ZZeIhjM202aXURWQMCB/edZ6nE GXoXuk/pVdZVTYXRtXdyMKxVEzueb6p6GzA+eNdoz3r83nz/tuf2at9jNN6OlpCfvVe7 p7PYf7RnMaCPnm5ni26seHJEVaUAuapZwrq61nWIb26M25SOn/EBJsGguwbo784kMU/W z9iA== 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=uOj8xoUHZLXZ1mtRDB1Z87n8UBgE7eeC0UyHLahSPC8=; b=CYvxhP0OLW18FyoUNo37mknHqY7oHES+Up8ngPkoxrBTQiS2uhXio8q9R4mh9OEPqs KLdm2vQ0zd+1hmng1BsZEdYH581//WyYmkSqKt7FbgI2D9Fsndftl293rR1XBrLj8WrM +M+SuYZbCmvEcVuXr3BejmUq+XfVi9eD4HimGy0m9YsKWJMfqGS299bmB9lisEmFhdBY egWc9nteOep8jEyKNtk5ody6pLPfcjOpuQlVmBFob4He3/PInnjUlmCQPLXcRMw0ti1m 9p4ZU8SY18esGnP83Zr7TDQO0T/eqkUY92qAXEpDq5MqujZXc7Ei+7R2CV25YRID9h80 bIwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cdym02gD; 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 x25si7048715edr.128.2019.10.06.10.33.58; Sun, 06 Oct 2019 10:34:21 -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=cdym02gD; 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 S1729277AbfJFRak (ORCPT + 99 others); Sun, 6 Oct 2019 13:30:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:56584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729265AbfJFRai (ORCPT ); Sun, 6 Oct 2019 13:30:38 -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 6EF1621479; Sun, 6 Oct 2019 17:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570383038; bh=JXsJn0E61UtLuEWduYdvBlin/nEHZ4PJC+mbabp26Us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cdym02gDw1fuaF1QAbrA1NBowZuJ2ZLXWY1vMjjsO7P6yInDiO1dt3mrA1+BSLJHH q8pIxUPg6zkeP03t8JHoWM3b+/UWyxFdGoJ7A/n9gz2FYCE4LL6A1HwoZGsg2Idxr0 VpT0iJ+R1zlBidIF6mKC5UF35zrOoZG5TlefsYsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , Lorenzo Pieralisi , Andrew Murray , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Fabio Estevam , kernel@pengutronix.de, linux-imx@nxp.com, Sasha Levin Subject: [PATCH 4.19 063/106] PCI: imx6: Propagate errors for optional regulators Date: Sun, 6 Oct 2019 19:21:09 +0200 Message-Id: <20191006171150.285512429@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 2170a09fb4b0f66e06e5bcdcbc98c9ccbf353650 ] 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: Richard Zhu Cc: Lucas Stach Cc: Shawn Guo Cc: Sascha Hauer Cc: Fabio Estevam Cc: kernel@pengutronix.de Cc: linux-imx@nxp.com Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pci-imx6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 3826b444298c1..3b2ceb5667289 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -807,8 +807,8 @@ static int imx6_pcie_probe(struct platform_device *pdev) imx6_pcie->vpcie = devm_regulator_get_optional(&pdev->dev, "vpcie"); if (IS_ERR(imx6_pcie->vpcie)) { - if (PTR_ERR(imx6_pcie->vpcie) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (PTR_ERR(imx6_pcie->vpcie) != -ENODEV) + return PTR_ERR(imx6_pcie->vpcie); imx6_pcie->vpcie = NULL; } -- 2.20.1