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

PCI: iproc: Propagate errors for optional PHYs

devm_phy_get() 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 devres structures. Propagating only -EPROBE_DEFER is
problematic because it results in these legitimately fatal errors being
treated as "PHY not specified in DT".

What we really want is to ignore the optional PHYs only if they have not
been specified in DT. devm_phy_optional_get() is a function that exactly
does what's required here, so use that instead.

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>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com

authored by

Thierry Reding and committed by
Lorenzo Pieralisi
c1e33666 8f9e1641

+3 -6
+3 -6
drivers/pci/controller/pcie-iproc-platform.c
··· 93 93 pcie->need_ib_cfg = of_property_read_bool(np, "dma-ranges"); 94 94 95 95 /* PHY use is optional */ 96 - pcie->phy = devm_phy_get(dev, "pcie-phy"); 97 - if (IS_ERR(pcie->phy)) { 98 - if (PTR_ERR(pcie->phy) == -EPROBE_DEFER) 99 - return -EPROBE_DEFER; 100 - pcie->phy = NULL; 101 - } 96 + pcie->phy = devm_phy_optional_get(dev, "pcie-phy"); 97 + if (IS_ERR(pcie->phy)) 98 + return PTR_ERR(pcie->phy); 102 99 103 100 ret = devm_of_pci_get_host_bridge_resources(dev, 0, 0xff, &resources, 104 101 &iobase);