]> git.baikalelectronics.ru Git - kernel.git/commitdiff
PCI: dwc-plat: Simplify dw_plat_pcie_probe() return values
authorBaikal Electronics <support@baikalelectronics.ru>
Fri, 24 Jun 2022 14:34:26 +0000 (17:34 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 6 Jul 2022 00:00:52 +0000 (19:00 -0500)
Save the return value in "ret" for all three cases (DW_PCIE_RC_TYPE,
DW_PCIE_EP_TYPE, default) handled by dw_plat_pcie_probe() and return from a
single place.

[bhelgaas: commit log]
Link: https://lore.kernel.org/r/20220624143428.8334-17-Sergey.Semin@baikalelectronics.ru
Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
drivers/pci/controller/dwc/pcie-designware-plat.c

index 97de6ad7f9dbacd81398dd404351d5f7052cf1a6..c6871bebf3fe676076bb2e9c3e2e82874f336a3e 100644 (file)
@@ -143,20 +143,21 @@ static int dw_plat_pcie_probe(struct platform_device *pdev)
                        return -ENODEV;
 
                ret = dw_plat_add_pcie_port(dw_plat_pcie, pdev);
-               if (ret < 0)
-                       return ret;
                break;
        case DW_PCIE_EP_TYPE:
                if (!IS_ENABLED(CONFIG_PCIE_DW_PLAT_EP))
                        return -ENODEV;
 
                pci->ep.ops = &pcie_ep_ops;
-               return dw_pcie_ep_init(&pci->ep);
+               ret = dw_pcie_ep_init(&pci->ep);
+               break;
        default:
                dev_err(dev, "INVALID device type %d\n", dw_plat_pcie->mode);
+               ret = -EINVAL;
+               break;
        }
 
-       return 0;
+       return ret;
 }
 
 static const struct dw_plat_pcie_of_data dw_plat_pcie_rc_of_data = {