Re: [PATCH v5 2/2] PCI: qcom: Add support for multi-root port

From: Manivannan Sadhasivam
Date: Thu Jul 03 2025 - 03:02:24 EST


On Thu, Jul 03, 2025 at 09:48:17AM GMT, Krishna Chaitanya Chundru wrote:
>
>
> On 7/2/2025 9:03 PM, Manivannan Sadhasivam wrote:
> > On Wed, Jul 02, 2025 at 04:50:42PM GMT, Krishna Chaitanya Chundru wrote:
> >
> > [...]
> >
> > > - ret = phy_init(pcie->phy);
> > > - if (ret)
> > > - goto err_pm_runtime_put;
> > > + for_each_available_child_of_node(dev->of_node, of_port) {
> > > + ret = qcom_pcie_parse_port(pcie, of_port);
> > > + of_node_put(of_port);
> > > + if (ret) {
> > > + if (ret != -ENOENT) {
> > > + dev_err_probe(pci->dev, ret,
> > > + "Failed to parse port nodes %d\n",
> > > + ret);
> > > + goto err_port_del;
> > > + }
> > > + break;
> > > + }
> > > + }
> > > +
> > > + /*
> > > + * In the case of properties not populated in root port, fallback to the
> > > + * legacy method of parsing the host bridge node. This is to maintain DT
> > > + * backwards compatibility.
> > > + */
> > > + if (ret) {
> > > + pcie->phy = devm_phy_optional_get(dev, "pciephy");
> > > + if (IS_ERR(pcie->phy)) {
> > > + ret = PTR_ERR(pcie->phy);
> > > + goto err_pm_runtime_put;
> >
> > Shouldn't this and below be err_port_del?
> >
> This is a legacy way of parsing property, if the execution
> comes here means the port parsing has failed and ports are not created.
> so err_port_del will not have any effect.
>

Oops. I got confused by the if (ret) flow. It would be more clear if a goto is
used to indicate that the legacy codeblock is skipped. I'll just incorporate it
while applying.

- Mani

--
மணிவண்ணன் சதாசிவம்