]> www.infradead.org Git - users/jedix/linux-maple.git/commit
scsi: ufs: Fix toggling of clk_gating.state when clock gating is not allowed
authorAvri Altman <avri.altman@wdc.com>
Tue, 28 Jan 2025 07:12:07 +0000 (09:12 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 3 Feb 2025 21:53:00 +0000 (16:53 -0500)
commit839a74b5649c9f41d939a05059b5ca6b17156d03
treeb5fef5c3a86b0a371148b96ffd28a09d20b8361b
parent3d4114a1d34413dfffa0094c2eb7b95e61087abd
scsi: ufs: Fix toggling of clk_gating.state when clock gating is not allowed

This commit addresses an issue where clk_gating.state is being toggled in
ufshcd_setup_clocks() even if clock gating is not allowed.

The fix is to add a check for hba->clk_gating.is_initialized before toggling
clk_gating.state in ufshcd_setup_clocks().

Since clk_gating.lock is now initialized unconditionally, it can no longer
lead to the spinlock being used before it is properly initialized, but
instead it is mostly for documentation purposes.

Fixes: 1ab27c9cf8b6 ("ufs: Add support for clock gating")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20250128071207.75494-3-avri.altman@wdc.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c