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

From: Bean Huo
Date: Tue Feb 01 2022 - 16:59:54 EST


From: Bean Huo <beanhuo@xxxxxxxxxx>

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@xxxxxxxxxx>
---
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