nto the driver’s “enable MCQ IRQs” helper will re-enable an already-enabled IRQ, causing an unbalanced enable. - The driver already guards enable/disable with this flag: - Disable path: sets the flag false after disabling (drivers/ufs/host/ufs-mediatek.c:741). - Enable path: bails out if already enabled and sets the flag true only after enabling (drivers/ufs/host/ufs-mediatek.c:755 and drivers/ufs/host/ufs-mediatek.c:762). - With the new line in `ufs_mtk_config_mcq_irq()` (drivers/ufs/host/ufs-mediatek.c:2193), the initial state is correct, so `ufs_mtk_mcq_enable_irq()` will correctly no-op on the first enable attempt when IRQs are already enabled. - How the bug manifested - `ufs_mtk_setup_clocks()`’s POST_CHANGE flow calls `ufs_mtk_mcq_enable_irq()` (drivers/ufs/host/ufs-mediatek.c:817). Before this patch, after `devm_request_irq()` the IRQs were already enabled but `is_mcq_intr_enabled` was still false, so the enable path would call `enable_irq()` again, risking “unbalanced IRQ enable” warnings. - The disable path is already consistent: `ufs_mtk_mcq_disable_irq()` uses the list of IRQs and flips the flag to false (drivers/ufs/host/ufs-mediatek.c:741), so subsequent enables are properly balanced. - Scope and risk - Change is a single-line state fix in one driver function, confined to the Mediatek UFS host driver. - No API, ABI, or architectural changes; no behavioral changes beyond preventing an incorrect extra `enable_irq()`. - The flag is set only after all IRQ requests succeed; if any `devm_request_irq()` fails, the function returns early and does not set the flag, preserving prior behavior. - Stable backport criteria - Fixes a real correctness issue that can lead to warnings and IRQ depth mismatches. - Small, contained, and low risk. - No feature addition; clear bug fix in a specific subsystem (SCSI UFS Mediatek host). Given the above, this is a good candidate for stable backporting wherever the Mediatek UFS MCQ driver and `is_mcq_intr_enabled` field exist. drivers/ufs/host/ufs-mediatek.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index 188f90e468c41..055b24758ca3d 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -2111,6 +2111,7 @@ static int ufs_mtk_config_mcq_irq(struct ufs_hba *hba) return ret; } } + host->is_mcq_intr_enabled = true; return 0; } -- 2.51.0[PATCH AUTOSEL 6.17-6.12] scsi: ufs: host: mediatek: Fix unbalanced IRQ enable issueSasha Levin undefinedpatches@lists.linux.dev, stable@vger.kernel.org undefined undefined undefined undefined undefined undefined undefined undefined undefined undefined