Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6025105ybn; Sun, 29 Sep 2019 10:42:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBGZTX7SZXYVuqjXvcz/MMeB5XvpBQQuUbvEkFpyTJwSHXpY/g8RqtHxrpGqGTfWee4u9Q X-Received: by 2002:a17:906:4b07:: with SMTP id y7mr15976436eju.126.1569778938405; Sun, 29 Sep 2019 10:42:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569778938; cv=none; d=google.com; s=arc-20160816; b=KADGPhXjJcs2ZeWTrIYtFNJlFBL5a9OcwNBX+uslcw61d71Lf2GtJlTuUI13IlOeKR ki4Q1G4/SLvF8q1ayixWPcXLsLFlbsTItcwwThMYMqtccYUdK0cPF9ZRVaC2uW4jRi1z qtotctAanFFSviZYJNlTWHb+a3MtPIrLRMyQVJINOMG+zKLJVrsu/QQ+8xaM2zSO4DpK y+tpaiUpQcAkVmXYx1oRFlx5Pa3zknXuEGwmGv8zsRVf3fMLbhgk/gze/JhLlyB6HlG1 ENw6fPiUL4hEFS2GhuLftNzdAgfON+hZ/nwI/ieHJoypSvPAfvYFB53S0YcDU/5pQn8o rsTA== 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=GJBW77nOnZMQfzp//Q8BxIUkIkNpgA0715u2cAE/dNc=; b=fl07crub3kY6kSMZHOnS7AS3NimecKPhI2lpEu7KpAty4i5ktEReIsFpJDcgGjNch/ 5TTwMOv6RW4CveEm+iGuUQpbzzmhS54NpuNGbvqGm2Ga3nWpMDoaed85CskrOLdw512n uK55gFmqpHU/bQbHrudsAWzUzAfJ+dv1vmtA01qD9Gf1DwbfD6WBjckGBL8Dlax+27A1 VKIrQ8+MOPvEAVS+BA2Q6KBRIlva7nuCQzZxcKVJfwU6hB0bG0OqSqOhDagW2IAjXvL7 D5eWCum5ikPi97DH993AtRVRqa9/WbJxpo96z9ct8celSiP07YxQHpfSj2/Le6O5FUaj d2Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QQCaLksq; 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 y13si5922054ede.219.2019.09.29.10.41.54; Sun, 29 Sep 2019 10:42:18 -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=QQCaLksq; 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 S1728994AbfI2RfJ (ORCPT + 99 others); Sun, 29 Sep 2019 13:35:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:47074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729566AbfI2Re6 (ORCPT ); Sun, 29 Sep 2019 13:34:58 -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 A1DF121928; Sun, 29 Sep 2019 17:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569778497; bh=r0VppsRO05cODlZfjJkNWNlLDib6ImkdtE/4yky8mDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QQCaLksqjj/pmSI1vAnYIuh2OYPxG9CpN+7b7BWacJHcc/cICoe2gpQtNNNJnbCzZ 4+QEU03V+Ec6ZorLyxZSnuONAEXMXKgwIwqCh1jiYbLrPrg82f9g6GjTDmT/Bmmq+9 jtSZrq6i6LV6E/9SA/Fe9S8vhPB+qEbw3t+dk6Ck= 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 4.19 18/33] PCI: histb: Propagate errors for optional regulators Date: Sun, 29 Sep 2019 13:34:06 -0400 Message-Id: <20190929173424.9361-18-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 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