linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: qcom-ep: Fix disabling global_irq in error path
@ 2022-10-05 13:58 Manivannan Sadhasivam
  2022-10-05 17:35 ` Bjorn Helgaas
  0 siblings, 1 reply; 4+ messages in thread
From: Manivannan Sadhasivam @ 2022-10-05 13:58 UTC (permalink / raw)
  To: lpieralisi
  Cc: kw, bhelgaas, linux-pci, robh, linux-arm-msm, linux-kernel,
	Manivannan Sadhasivam, kernel test robot

After commit 6a534df3da88 ("PCI: qcom-ep: Disable IRQs during driver
remove"), the global irq is stored in the "global_irq" member of pcie_ep
structure. This eliminates the need of local "irq" variable but that
commit didn't remove the "irq" variable usage completely and it is still
used for disable_irq() in error path which is wrong since the variable is
uninitialized.

Fix this by removing the local "irq" variable and using
"pcie_ep->global_irq" for disable_irq() in error path.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 6a534df3da88 ("PCI: qcom-ep: Disable IRQs during driver remove")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 16bb8f166c3b..00a0728d5ecd 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -614,7 +614,7 @@ static irqreturn_t qcom_pcie_ep_perst_irq_thread(int irq, void *data)
 static int qcom_pcie_ep_enable_irq_resources(struct platform_device *pdev,
 					     struct qcom_pcie_ep *pcie_ep)
 {
-	int irq, ret;
+	int ret;
 
 	pcie_ep->global_irq = platform_get_irq_byname(pdev, "global");
 	if (pcie_ep->global_irq < 0)
@@ -637,7 +637,7 @@ static int qcom_pcie_ep_enable_irq_resources(struct platform_device *pdev,
 					"perst_irq", pcie_ep);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to request PERST IRQ\n");
-		disable_irq(irq);
+		disable_irq(pcie_ep->global_irq);
 		return ret;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: qcom-ep: Fix disabling global_irq in error path
  2022-10-05 13:58 [PATCH] PCI: qcom-ep: Fix disabling global_irq in error path Manivannan Sadhasivam
@ 2022-10-05 17:35 ` Bjorn Helgaas
  2022-10-06  6:35   ` Lorenzo Pieralisi
  0 siblings, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2022-10-05 17:35 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: lpieralisi, kw, bhelgaas, linux-pci, robh, linux-arm-msm,
	linux-kernel, kernel test robot

On Wed, Oct 05, 2022 at 07:28:52PM +0530, Manivannan Sadhasivam wrote:
> After commit 6a534df3da88 ("PCI: qcom-ep: Disable IRQs during driver
> remove"), the global irq is stored in the "global_irq" member of pcie_ep
> structure. This eliminates the need of local "irq" variable but that
> commit didn't remove the "irq" variable usage completely and it is still
> used for disable_irq() in error path which is wrong since the variable is
> uninitialized.
> 
> Fix this by removing the local "irq" variable and using
> "pcie_ep->global_irq" for disable_irq() in error path.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Fixes: 6a534df3da88 ("PCI: qcom-ep: Disable IRQs during driver remove")
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

For today's "next" branch, I dropped 6a534df3da88 and the subsequent
patches.  Hopefully Lorenzo can squash this fix into 6a534df3da88.

I could clone the branch and squash it myself, but that's pretty
fiddly and I usually mess it up.

> ---
>  drivers/pci/controller/dwc/pcie-qcom-ep.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> index 16bb8f166c3b..00a0728d5ecd 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> @@ -614,7 +614,7 @@ static irqreturn_t qcom_pcie_ep_perst_irq_thread(int irq, void *data)
>  static int qcom_pcie_ep_enable_irq_resources(struct platform_device *pdev,
>  					     struct qcom_pcie_ep *pcie_ep)
>  {
> -	int irq, ret;
> +	int ret;
>  
>  	pcie_ep->global_irq = platform_get_irq_byname(pdev, "global");
>  	if (pcie_ep->global_irq < 0)
> @@ -637,7 +637,7 @@ static int qcom_pcie_ep_enable_irq_resources(struct platform_device *pdev,
>  					"perst_irq", pcie_ep);
>  	if (ret) {
>  		dev_err(&pdev->dev, "Failed to request PERST IRQ\n");
> -		disable_irq(irq);
> +		disable_irq(pcie_ep->global_irq);
>  		return ret;
>  	}
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: qcom-ep: Fix disabling global_irq in error path
  2022-10-05 17:35 ` Bjorn Helgaas
@ 2022-10-06  6:35   ` Lorenzo Pieralisi
  2022-10-06 16:07     ` Bjorn Helgaas
  0 siblings, 1 reply; 4+ messages in thread
From: Lorenzo Pieralisi @ 2022-10-06  6:35 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Manivannan Sadhasivam, kw, bhelgaas, linux-pci, robh,
	linux-arm-msm, linux-kernel, kernel test robot

On Wed, Oct 05, 2022 at 12:35:29PM -0500, Bjorn Helgaas wrote:
> On Wed, Oct 05, 2022 at 07:28:52PM +0530, Manivannan Sadhasivam wrote:
> > After commit 6a534df3da88 ("PCI: qcom-ep: Disable IRQs during driver
> > remove"), the global irq is stored in the "global_irq" member of pcie_ep
> > structure. This eliminates the need of local "irq" variable but that
> > commit didn't remove the "irq" variable usage completely and it is still
> > used for disable_irq() in error path which is wrong since the variable is
> > uninitialized.
> > 
> > Fix this by removing the local "irq" variable and using
> > "pcie_ep->global_irq" for disable_irq() in error path.
> > 
> > Reported-by: kernel test robot <lkp@intel.com>
> > Fixes: 6a534df3da88 ("PCI: qcom-ep: Disable IRQs during driver remove")
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> 
> For today's "next" branch, I dropped 6a534df3da88 and the subsequent
> patches.  Hopefully Lorenzo can squash this fix into 6a534df3da88.

Done - the pci/qcom branch successfully passed kbot's tests as well.

Lorenzo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: qcom-ep: Fix disabling global_irq in error path
  2022-10-06  6:35   ` Lorenzo Pieralisi
@ 2022-10-06 16:07     ` Bjorn Helgaas
  0 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2022-10-06 16:07 UTC (permalink / raw)
  To: Lorenzo Pieralisi
  Cc: Manivannan Sadhasivam, kw, bhelgaas, linux-pci, robh,
	linux-arm-msm, linux-kernel, kernel test robot

On Thu, Oct 06, 2022 at 08:35:34AM +0200, Lorenzo Pieralisi wrote:
> On Wed, Oct 05, 2022 at 12:35:29PM -0500, Bjorn Helgaas wrote:
> > On Wed, Oct 05, 2022 at 07:28:52PM +0530, Manivannan Sadhasivam wrote:
> > > After commit 6a534df3da88 ("PCI: qcom-ep: Disable IRQs during driver
> > > remove"), the global irq is stored in the "global_irq" member of pcie_ep
> > > structure. This eliminates the need of local "irq" variable but that
> > > commit didn't remove the "irq" variable usage completely and it is still
> > > used for disable_irq() in error path which is wrong since the variable is
> > > uninitialized.
> > > 
> > > Fix this by removing the local "irq" variable and using
> > > "pcie_ep->global_irq" for disable_irq() in error path.
> > > 
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Fixes: 6a534df3da88 ("PCI: qcom-ep: Disable IRQs during driver remove")
> > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > 
> > For today's "next" branch, I dropped 6a534df3da88 and the subsequent
> > patches.  Hopefully Lorenzo can squash this fix into 6a534df3da88.
> 
> Done - the pci/qcom branch successfully passed kbot's tests as well.

Thanks, picked this up yesterday :)

Bjorn

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-06 16:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-05 13:58 [PATCH] PCI: qcom-ep: Fix disabling global_irq in error path Manivannan Sadhasivam
2022-10-05 17:35 ` Bjorn Helgaas
2022-10-06  6:35   ` Lorenzo Pieralisi
2022-10-06 16:07     ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).