Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Thierry Reding and committed by
Lorenzo Pieralisi
0e3ff0ac 5f9e832c

+8 -8
+8 -8
drivers/pci/controller/pcie-rockchip-host.c
··· 608 608 609 609 rockchip->vpcie12v = devm_regulator_get_optional(dev, "vpcie12v"); 610 610 if (IS_ERR(rockchip->vpcie12v)) { 611 - if (PTR_ERR(rockchip->vpcie12v) == -EPROBE_DEFER) 612 - return -EPROBE_DEFER; 611 + if (PTR_ERR(rockchip->vpcie12v) != -ENODEV) 612 + return PTR_ERR(rockchip->vpcie12v); 613 613 dev_info(dev, "no vpcie12v regulator found\n"); 614 614 } 615 615 616 616 rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3"); 617 617 if (IS_ERR(rockchip->vpcie3v3)) { 618 - if (PTR_ERR(rockchip->vpcie3v3) == -EPROBE_DEFER) 619 - return -EPROBE_DEFER; 618 + if (PTR_ERR(rockchip->vpcie3v3) != -ENODEV) 619 + return PTR_ERR(rockchip->vpcie3v3); 620 620 dev_info(dev, "no vpcie3v3 regulator found\n"); 621 621 } 622 622 623 623 rockchip->vpcie1v8 = devm_regulator_get_optional(dev, "vpcie1v8"); 624 624 if (IS_ERR(rockchip->vpcie1v8)) { 625 - if (PTR_ERR(rockchip->vpcie1v8) == -EPROBE_DEFER) 626 - return -EPROBE_DEFER; 625 + if (PTR_ERR(rockchip->vpcie1v8) != -ENODEV) 626 + return PTR_ERR(rockchip->vpcie1v8); 627 627 dev_info(dev, "no vpcie1v8 regulator found\n"); 628 628 } 629 629 630 630 rockchip->vpcie0v9 = devm_regulator_get_optional(dev, "vpcie0v9"); 631 631 if (IS_ERR(rockchip->vpcie0v9)) { 632 - if (PTR_ERR(rockchip->vpcie0v9) == -EPROBE_DEFER) 633 - return -EPROBE_DEFER; 632 + if (PTR_ERR(rockchip->vpcie0v9) != -ENODEV) 633 + return PTR_ERR(rockchip->vpcie0v9); 634 634 dev_info(dev, "no vpcie0v9 regulator found\n"); 635 635 } 636 636