[PATCH v2 09/10] PCI: keystone: Exit ks_pcie_probe() for the default switch-case of "mode"

Siddharth Vadapalli s-vadapalli at ti.com
Sat Sep 20 01:38:58 PDT 2025


On Sat, Sep 20, 2025 at 01:57:34PM +0530, Manivannan Sadhasivam wrote:
> On Sat, Sep 20, 2025 at 01:39:22PM +0530, Siddharth Vadapalli wrote:
> > On Sat, Sep 20, 2025 at 12:06:46AM +0530, Manivannan Sadhasivam wrote:
> > > On Fri, Sep 12, 2025 at 05:46:20PM +0530, Siddharth Vadapalli wrote:
> > > > In ks_pcie_probe(), the switch-case for the "mode" is used to configure
> > > > the PCIe Controller for either Root-Complex or Endpoint mode of operation.
> > > > Prior to the switch-case statement for "mode" an invalid mode will result
> > > > in probe failure only if "dw_pcie_ver_is_ge(pci, 480A)" is true, which
> > > > is the case for the AM654 platform. On the other hand, when that is not
> > > > the case, "ks_pcie_set_mode()" will be invoked, which does not validate
> > > > the mode. As a result, it is possible for the switch-case statement for
> > > > "mode" to receive an invalid mode. Currently, an error message is displayed
> > > > in the "default" case where "mode" is neither "DW_PCIE_RC_TYPE" nor
> > > > "DW_PCIE_EP_TYPE", but the probe succeeds. However, since the configuration
> > > > required for Root-Complex and Endpoint mode have not been performed, the
> > > > Controller is not operational.
> > > > 
> > > > Fix this by exiting "ks_pcie_probe()" with the return value of "-EINVAL"
> > > > in addition to displaying the existing error message.
> > > > 
> > > > Signed-off-by: Siddharth Vadapalli <s-vadapalli at ti.com>
> > > 
> > > Fixes tag? And probably CC stable since the controller seems to be not
> > > operations without this fix.
> > 
> > While I had mentioned the rationale for not including the 'Fixes tag' in
> > the v1 patch below the tearline, I forgot to add it in this patch. I will
> > quote the same below:
> > 
> >     NOTE: A "Fixes" tag is ommitted on purpose since the fix is not crucial:
> >     1. It doesn't fix a crash or any fatal error
> >     2. It doesn't enable controller functionality by fixing the issue
> > 
> 
> Fixes tag should be added irrespective of the cruciality of the bug.

Ok, I will include the tag in the v3 series.

> 
> >     Therefore, the patch may not be worth backporting.
> > 
> 
> Agree with this though.
> 
> > Prior to this patch, the probe succeeded and the controller was
> > unusable. Post this patch, the probe will fail and the controller is
> > still unusable. Behavior is identical from a usability perspective but
> > the user is aware of the issue since the probe fails.
> > 
> 
> Ok. I think the description could reworded to make it more clear. The actual
> issue is that the default case lacks setting the errno, leading to probe
> success. But the addition of ks_pcie_set_mode() and others seem to cause little
> bit confusion.

I will update the commit message and keep it concise to highlight the
issue. I understand that the additional information provided in order to
set the context might have been counterproductive.

Thank you for reviewing the patch and providing feedback.

Regards,
Siddharth.



More information about the linux-arm-kernel mailing list