Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6023742ybn; Sun, 29 Sep 2019 10:40:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpM1POIGgbrtO2rxZNGugICMahwH634ltfUD/UiyinP0NJbWG3Pqn3/rUUp5rHK2KMiom8 X-Received: by 2002:a50:9208:: with SMTP id i8mr15399330eda.3.1569778815416; Sun, 29 Sep 2019 10:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569778815; cv=none; d=google.com; s=arc-20160816; b=nAUZZzFimjYTgHezozUfQ0ThPjkV8Ps9bMPWzdPF3KK5hoZWA22Q0dny6DgK5ADASt Zjz/nZm7vj2nzjWEV9lKl5ZABNr/oA00JcBCsic+v6Bf/7L1hcM7jJsSx/FOKzVhZMMp +rUYMN3vRQFiB4lMKalp+6g9aOCqvi2DgS2qzZpBRqMgWQurbLJQPWWH+VNT9UEHoQKM kPnJ2qYwaULbhPZu6HBpNLsTaSDDkaQAM8lQEGhd1C5pWEErNH9h+rUEJba2yzeyxZ23 3lbnK+ItKkc4kvfxX2r0KGU0Sr52/90Q16p2Eqc1ZVWJkB9maXYSx8Uocp9mcrDLPeoZ Bs9A== 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:cc:to:from :dkim-signature; bh=uOj8xoUHZLXZ1mtRDB1Z87n8UBgE7eeC0UyHLahSPC8=; b=TxnWZevB1U8BkOgDChhoZ6rsFgBusqkx8BquPi/riizy5gD2xcD0KgUBN5m+mHBeJa ukpnt9FNMmE4P/fDUU8O0TluMUQiJ5gCLHtPXC0lMqaY9kNvUozMjouM3zIgpSiETdmF UsAoXo3NudyPdP7wE4thoSjhlk9YfRivz0FsVlRWxqJqdRy7T08SXRm1sTQXU+zHYei1 I8mc7RiqeeeKyBVIJoZLPF7X+oXB3YMPOdTwbT2LxUSm69aqjIsYhPZa97nuUUiW0Dut V6xFFrCF9Vfjz3rscDhGX4ll6fL3shwmbvvj6R681l3zrXc/8ZHPwputr9LGT83A0qDV /6bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b2XMsOMJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d25si5340283edv.319.2019.09.29.10.39.51; Sun, 29 Sep 2019 10:40:15 -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=b2XMsOMJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729474AbfI2RfM (ORCPT + 99 others); Sun, 29 Sep 2019 13:35:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:47090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730485AbfI2Re7 (ORCPT ); Sun, 29 Sep 2019 13:34:59 -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 DB99021A4C; Sun, 29 Sep 2019 17:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569778499; bh=JXsJn0E61UtLuEWduYdvBlin/nEHZ4PJC+mbabp26Us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b2XMsOMJlYdc0NeRmUvu6NrZxKDTzc4um84kEx0Dv9GegCRLYoS2eSA+IL4i0BWuh TyA837ORbJ1SdRvcTv7z80aIscgQs1+n41lcmVp51NfFIRQ3IvbrgohRnf9xzWLJ4l nHkDyPyxYACgv1TKEn94ZzrhAHud21nE18dEyPOs= 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.19 19/33] PCI: imx6: Propagate errors for optional regulators Date: Sun, 29 Sep 2019 13:34:07 -0400 Message-Id: <20190929173424.9361-19-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190929173424.9361-1-sashal@kernel.org> References: <20190929173424.9361-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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