[PATCH] PCI: kirin: Fix kirin960-pcie probe failure issue

Bean Huo
2022-02-01T21:59:54Z

From: Bean Huo <beanhuo@micron.com>

of_device_get_match_data() will return 'enum pcie_kirin_phy_type' type
value, and most likely the return value will be PCIE_KIRIN_INTERNAL_PHY == 0.
This will cause the PCI probe to fail. And of_device_get_match_data() does not
require error checking on its return on devicetree based platform.

So,this patch is to remove unnecessary error checking to fix kirin960-pcie
probe failure issue.

Fixes: a622435fbe1a ("PCI: kirin: Prefer of_device_get_match_data()")
Signed-off-by: Bean Huo <beanhuo@micron.com>
---
drivers/pci/controller/dwc/pcie-kirin.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
index fa6886d66488..e102aa6efb7f 100644
--- a/drivers/pci/controller/dwc/pcie-kirin.c
+++ b/drivers/pci/controller/dwc/pcie-kirin.c
@@ -781,12 +781,7 @@ static int kirin_pcie_probe(struct platform_device *pdev)
return -EINVAL;
}

- phy_type = (long)of_device_get_match_data(dev);
- if (!phy_type) {
- dev_err(dev, "OF data missing\n");
- return -EINVAL;
- }
-
+ phy_type = (enum pcie_kirin_phy_type)of_device_get_match_data(dev);

kirin_pcie = devm_kzalloc(dev, sizeof(struct kirin_pcie), GFP_KERNEL);
if (!kirin_pcie)
--
2.25.1