All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Moon <linux.amoon@gmail.com>
To: "Daire McNamara" <daire.mcnamara@microchip.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Kevin Xie" <kevin.xie@starfivetech.com>,
	"Minda Chen" <minda.chen@starfivetech.com>,
	"Conor Dooley" <conor.dooley@microchip.com>,
	"Mason Huo" <mason.huo@starfivetech.com>,
	linux-pci@vger.kernel.org (open list:PCI DRIVER FOR PLDA PCIE IP),
	linux-kernel@vger.kernel.org (open list)
Cc: Anand Moon <linux.amoon@gmail.com>
Subject: [PATCH v2 1/2] PCI: plda: Remove unused IRQ handler and simplify IRQ request logic
Date: Sun, 16 Mar 2025 22:42:45 +0530	[thread overview]
Message-ID: <20250316171250.5901-1-linux.amoon@gmail.com> (raw)

The plda_event_handler() function has been removed since it only returned
IRQ_HANDLED without performing any processing. Additionally, the IRQ
request logic in plda_init_interrupts() has been streamlined by removing
the redundant devm_request_irq() call when the request_event_irq()
callback is not defined.

Change ensures that interrupts are requested exclusively through the
request_event_irq() callback when available, enhancing code clarity
and maintainability.

Changes help fix kmemleak reported following debug log.

$ sudo cat /sys/kernel/debug/kmemleak
unreferenced object 0xffffffd6c47c2600 (size 128):
  comm "kworker/u16:2", pid 38, jiffies 4294942263
  hex dump (first 32 bytes):
    cc 7c 5a 8d ff ff ff ff 40 b0 47 c8 d6 ff ff ff  .|Z.....@.G.....
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace (crc 4f07ff07):
    __create_object+0x2a/0xfc
    kmemleak_alloc+0x38/0x98
    __kmalloc_cache_noprof+0x296/0x444
    request_threaded_irq+0x168/0x284
    devm_request_threaded_irq+0xa8/0x13c
    plda_init_interrupts+0x46e/0x858
    plda_pcie_host_init+0x356/0x468
    starfive_pcie_probe+0x2f6/0x398
    platform_probe+0x106/0x150
    really_probe+0x30e/0x746
    __driver_probe_device+0x11c/0x2c2
    driver_probe_device+0x5e/0x316
    __device_attach_driver+0x296/0x3a4
    bus_for_each_drv+0x1d0/0x260
    __device_attach+0x1fa/0x2d6
    device_initial_probe+0x14/0x28
unreferenced object 0xffffffd6c47c2900 (size 128):
  comm "kworker/u16:2", pid 38, jiffies 4294942281

Fixes: 4602c370bdf6 ("PCI: microchip: Move IRQ functions to pcie-plda-host.c")
Cc: Minda Chen <minda.chen@starfivetech.com>
Signed-off-by: Anand Moon <linux.amoon@gmail.com>
---
v1: drop the dummy IRQ handler used in previous version
   [0] https://lore.kernel.org/linux-pci/20250224144155.omzrmls7hpjqw6yl@thinkpad/T/
---
 drivers/pci/controller/plda/pcie-plda-host.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/pci/controller/plda/pcie-plda-host.c b/drivers/pci/controller/plda/pcie-plda-host.c
index 4153214ca4103..f7edfa97723f8 100644
--- a/drivers/pci/controller/plda/pcie-plda-host.c
+++ b/drivers/pci/controller/plda/pcie-plda-host.c
@@ -280,11 +280,6 @@ static u32 plda_get_events(struct plda_pcie_rp *port)
 	return events;
 }
 
-static irqreturn_t plda_event_handler(int irq, void *dev_id)
-{
-	return IRQ_HANDLED;
-}
-
 static void plda_handle_event(struct irq_desc *desc)
 {
 	struct plda_pcie_rp *port = irq_desc_get_handler_data(desc);
@@ -452,16 +447,13 @@ int plda_init_interrupts(struct platform_device *pdev,
 			return -ENXIO;
 		}
 
-		if (event->request_event_irq)
+		if (event->request_event_irq) {
 			ret = event->request_event_irq(port, event_irq, i);
-		else
-			ret = devm_request_irq(dev, event_irq,
-					       plda_event_handler,
-					       0, NULL, port);
-
-		if (ret) {
-			dev_err(dev, "failed to request IRQ %d\n", event_irq);
-			return ret;
+			if (ret) {
+				dev_err(dev, "failed to request IRQ %d\n",
+					event_irq);
+				return ret;
+			}
 		}
 	}
 

base-commit: cb82ca153949c6204af793de24b18a04236e79fd
-- 
2.48.1


             reply	other threads:[~2025-03-16 17:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-16 17:12 Anand Moon [this message]
2025-03-16 17:12 ` [PATCH v2 2/2] PCI: starfive: Simplify event doorbell bitmap initialization in pcie-starfive Anand Moon
2025-03-17  2:23   ` Minda Chen
2025-03-17  3:26     ` Anand Moon
     [not found]       ` <SJ1PR11MB6249AC13C9F44545FF18A31C96DE2@SJ1PR11MB6249.namprd11.prod.outlook.com>
2025-03-18 15:46         ` Anand Moon
2025-04-19 10:32   ` Manivannan Sadhasivam
2025-04-02  7:40 ` [PATCH v2 1/2] PCI: plda: Remove unused IRQ handler and simplify IRQ request logic Anand Moon
2025-04-19 10:25 ` Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250316171250.5901-1-linux.amoon@gmail.com \
    --to=linux.amoon@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=conor.dooley@microchip.com \
    --cc=daire.mcnamara@microchip.com \
    --cc=kevin.xie@starfivetech.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mason.huo@starfivetech.com \
    --cc=minda.chen@starfivetech.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.