From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3D3DC4360C for ; Sun, 29 Sep 2019 17:38:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE28521906 for ; Sun, 29 Sep 2019 17:38:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569778713; bh=rqIDfpoejZDcFJ9Lx/ILUg+s18yzaiLxAcuONLtaes8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=aXCbptVsYGn50Hp6+TYb/Z563YDZfDKjbLURFM+CZO7Gceko7av2VoMPY3FEgYQF1 FQwdVHGh9tfYQXxBIssE35Je/u3TZ+gMWSq6efKvj+42qK44rDH6bMcepF1HhFHasb qaUoHamKMT0CkQG9690UYSh0R6q3pA/AwoO+Erlc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730712AbfI2RgF (ORCPT ); Sun, 29 Sep 2019 13:36:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:48408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730729AbfI2RgE (ORCPT ); Sun, 29 Sep 2019 13:36:04 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D05662196E; Sun, 29 Sep 2019 17:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569778564; bh=rqIDfpoejZDcFJ9Lx/ILUg+s18yzaiLxAcuONLtaes8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OwnmGl+Yz4ZEDSdo/fVJ+uDpusnuH1t3Naz/kZgnVhShWw1a0qDexUCIgQorhQXBu FW2U8IB4hO7Fu2boDLV2G3oVBjhBcvappWF2T1OF6829miO4voZBDAG1G+yRiQU4fo aqhEBCYkHJ3R4fC4xocavm+2/piUlVsxLe8j13Dw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: 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 , linux-pci@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 14/23] PCI: imx6: Propagate errors for optional regulators Date: Sun, 29 Sep 2019 13:35:24 -0400 Message-Id: <20190929173535.9744-14-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190929173535.9744-1-sashal@kernel.org> References: <20190929173535.9744-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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/dwc/pci-imx6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c index 1f1069b70e45a..5509b6e2de94b 100644 --- a/drivers/pci/dwc/pci-imx6.c +++ b/drivers/pci/dwc/pci-imx6.c @@ -827,8 +827,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