PCI: rockchip: Propagate errors for optional regulators
authorThierry Reding <treding@nvidia.com>
Thu, 29 Aug 2019 10:53:14 +0000 (12:53 +0200)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Wed, 4 Sep 2019 14:37:47 +0000 (15:37 +0100)
commit0e3ff0ac5f71bdb6be2a698de0ed0c7e6e738269
tree5482b158cee4897571fe9d67431dc787f564687c
parent5f9e832c137075045d15cd6899ab0505cfb2ca4b
PCI: rockchip: Propagate errors for optional regulators

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.

Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-rockchip@lists.infradead.org
drivers/pci/controller/pcie-rockchip-host.c