]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
scsi: ufs: core: Add ufshcd_update_evt_hist() for UFS suspend error
authorSeunghwan Baek <sh8267.baek@samsung.com>
Wed, 10 Dec 2025 06:38:54 +0000 (15:38 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Jan 2026 11:57:16 +0000 (12:57 +0100)
commit c9f36f04a8a2725172cdf2b5e32363e4addcb14c upstream.

If UFS resume fails, the event history is updated in ufshcd_resume(), but
there is no code anywhere to record UFS suspend. Therefore, add code to
record UFS suspend error event history.

Fixes: dd11376b9f1b ("scsi: ufs: Split the drivers/scsi/ufs directory")
Cc: stable@vger.kernel.org
Signed-off-by: Seunghwan Baek <sh8267.baek@samsung.com>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Link: https://patch.msgid.link/20251210063854.1483899-2-sh8267.baek@samsung.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ufs/core/ufshcd.c

index a921a9098a291e0afb55934ea7518e97f77b397f..ba1bb3953cf69a841a8a01972e642b1f86b02e53 100644 (file)
@@ -10223,7 +10223,7 @@ static int ufshcd_suspend(struct ufs_hba *hba)
        ret = ufshcd_setup_clocks(hba, false);
        if (ret) {
                ufshcd_enable_irq(hba);
-               return ret;
+               goto out;
        }
        if (ufshcd_is_clkgating_allowed(hba)) {
                hba->clk_gating.state = CLKS_OFF;
@@ -10235,6 +10235,9 @@ static int ufshcd_suspend(struct ufs_hba *hba)
        /* Put the host controller in low power mode if possible */
        ufshcd_hba_vreg_set_lpm(hba);
        ufshcd_pm_qos_update(hba, false);
+out:
+       if (ret)
+               ufshcd_update_evt_hist(hba, UFS_EVT_SUSPEND_ERR, (u32)ret);
        return ret;
 }