[PATCH v2 1/2] PCI: plda: Remove unused IRQ handler and simplify IRQ request logic

From: Anand Moon
Date: Sun Mar 16 2025 - 13:13:18 EST


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@xxxxxxxxxxxxxxxx>
Signed-off-by: Anand Moon <linux.amoon@xxxxxxxxx>
---
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