Skip to content

Commit b630a04

Browse files
spandruvadarafaeljw
authored andcommitted
thermal: intel: int340x: Fix kernel warning during MSI cleanup
On some pre-production Lunar Lake systems, there is a kernel warning: remove_proc_entry: removing non-empty directory 'irq/172' WARNING: CPU: 0 PID: 501 at fs/proc/generic.c:717 remove_proc_entry+0x1b4/0x1e0 ... ... remove_proc_entry+0x1b4/0x1e0 report_bug+0x182/0x1b0 handle_bug+0x51/0xa0 exc_invalid_op+0x18/0x80 asm_exc_invalid_op+0x1b/0x20 remove_proc_entry+0x1b4/0x1e0 remove_proc_entry+0x1b4/0x1e0 unregister_irq_proc+0xf2/0x120 free_desc+0x41/0xe0 irq_domain_free_irqs+0x138/0x1c0 irq_free_descs+0x52/0x80 irq_domain_free_irqs+0x151/0x1c0 msi_domain_free_locked.part.0+0x17e/0x1c0 msi_domain_free_irqs_all_locked+0x74/0xc0 pci_msi_teardown_msi_irqs+0x50/0x60 pci_free_msi_irqs+0x12/0x40 pci_free_irq_vectors+0x58/0x70 On these systems, not all the MSI thermal vectors are valid. This causes devm_request_threaded_irq() to fail for some vectors. As part of the clean up on this error, pci_free_irq_vectors() is called without calling devm_free_irq(). This causes the above warning. Add a function proc_thermal_free_msi() to call devm_free_irq() for all successfully registered IRQ handlers, then call pci_free_irq_vectors(). Call this function for MSI cleanup. Fixes: 7a9a8c5 ("thermal: intel: int340x: Support MSI interrupt for Lunar Lake") Reported-by: Yijun Shen <[email protected]> Tested-by: Yijun Shen <[email protected]> Signed-off-by: Srinivas Pandruvada <[email protected]> Reviewed-by: Zhang Rui <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 8400291 commit b630a04

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,18 @@ static struct thermal_zone_params tzone_params = {
278278

279279
static bool msi_irq;
280280

281+
static void proc_thermal_free_msi(struct pci_dev *pdev, struct proc_thermal_pci *pci_info)
282+
{
283+
int i;
284+
285+
for (i = 0; i < MSI_THERMAL_MAX; i++) {
286+
if (proc_thermal_msi_map[i])
287+
devm_free_irq(&pdev->dev, proc_thermal_msi_map[i], pci_info);
288+
}
289+
290+
pci_free_irq_vectors(pdev);
291+
}
292+
281293
static int proc_thermal_setup_msi(struct pci_dev *pdev, struct proc_thermal_pci *pci_info)
282294
{
283295
int ret, i, irq;
@@ -310,7 +322,7 @@ static int proc_thermal_setup_msi(struct pci_dev *pdev, struct proc_thermal_pci
310322
return 0;
311323

312324
err_free_msi_vectors:
313-
pci_free_irq_vectors(pdev);
325+
proc_thermal_free_msi(pdev, pci_info);
314326

315327
return ret;
316328
}
@@ -397,7 +409,7 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev, const struct pci_device_
397409

398410
err_free_vectors:
399411
if (msi_irq)
400-
pci_free_irq_vectors(pdev);
412+
proc_thermal_free_msi(pdev, pci_info);
401413
err_ret_tzone:
402414
thermal_zone_device_unregister(pci_info->tzone);
403415
err_del_legacy:

0 commit comments

Comments
 (0)