Skip to contentSkip to conversation

scsi: ufs: host: mediatek: make read-only array scale_us static const

PATCH Applied Colin Ian King 3 participants 3 messages Dec 19, 2025 – Jan 4

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: ufs: host: mediatek: make read-only array scale_us static const

Don't populate the read-only array scale_us on the stack at run time, instead make it static const.

---
 drivers/ufs/host/ufs-mediatek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/host/ufs-mediatek.c +1 -1
index ecbbf52bf734..66b11cc0703b 100644
@@ -1112,7 +1112,7 @@ static void ufs_mtk_setup_clk_gating(struct ufs_hba *hba)
 	unsigned long flags;
 	u32 ah_ms = 10;
 	u32 ah_scale, ah_timer;
-	u32 scale_us[] = {1, 10, 100, 1000, 10000, 100000};
+	static const u32 scale_us[] = {1, 10, 100, 1000, 10000, 100000};
 
 	if (ufshcd_is_clkgating_allowed(hba)) {
 		if (ufshcd_is_auto_hibern8_supported(hba) && hba->ahit) {
Signature · 1 line
2.51.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Colin Ian King

Don't populate the read-only array scale_us on the stack at run time, instead make it static const.

---
 drivers/ufs/host/ufs-mediatek.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ufs/host/ufs- renamed from drivers/ufs/host/ufs-mediatek.c +0 -0

mediatek.c
index ecbbf52bf734..66b11cc0703b 100644

drivers/ufs/host/ufs-mediatek.c static void ufs_mtk_setup_clk_gating(struct · line 1118

Quoted 8 lines
drivers/ufs/host/ufs-mediatek.c +1 -1
@@ -1112,7 +1112,7 @@ static void ufs_mtk_setup_clk_gating(struct
 ufs_hba *hba)
         unsigned long flags;
         u32 ah_ms = 10;
         u32 ah_scale, ah_timer;
-       u32 scale_us[] = {1, 10, 100, 1000, 10000, 100000};
+       static const u32 scale_us[] = {1, 10, 100, 1000, 10000,
 100000};