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=ham 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 A5D5DC352A9 for ; Sun, 29 Sep 2019 17:41:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78B9D2086A for ; Sun, 29 Sep 2019 17:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569778885; bh=qGQ9HN8LkKwm6Kshzu4NmFigna+xkzLDeB9AZNaGBU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=tH9Eqhi8yMoABnzSLe/SfYK7yK092UUKJFzGKbh28LPsdDYog3SHN2JaSnSLmAcAp r42dpPHtxYiN0XRGt7PnMijA86/7F5sl2oSUkwWmB3wlbNXWBOixybW/ZO9C9TBf2h JfaF2HvvgtGf/V6z7y1c89TBrNN8t+vOc6WBOYOQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730410AbfI2RlZ (ORCPT ); Sun, 29 Sep 2019 13:41:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:44978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730123AbfI2Rdi (ORCPT ); Sun, 29 Sep 2019 13:33:38 -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 400DE21925; Sun, 29 Sep 2019 17:33:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569778418; bh=qGQ9HN8LkKwm6Kshzu4NmFigna+xkzLDeB9AZNaGBU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qEn0OkEuybXEkUBsjKTdotDsGE/COzDS/xqmwkUxHQ6/cSICI7/eonEAwj1m9bzlz J3LAkMw9onRlUWnCCMPcS3LwujyRy411ib3hEaMpQOO5qV/Qltp0f9js1bU1FEWaoE JQtjYtKTp4EIxtYEyCBT7dD6m7PkF3L21WcV3QhQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Thierry Reding , Lorenzo Pieralisi , Andrew Murray , Shawn Guo , Sasha Levin , linux-pci@vger.kernel.org Subject: [PATCH AUTOSEL 5.2 25/42] PCI: histb: Propagate errors for optional regulators Date: Sun, 29 Sep 2019 13:32:24 -0400 Message-Id: <20190929173244.8918-25-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190929173244.8918-1-sashal@kernel.org> References: <20190929173244.8918-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 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 954bc2b74bbcd..811b5c6d62eae 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