Skip to contentSkip to conversation

leds: aw200xx: make read-only array coeff_table static const

PATCH Applied Colin Ian King 2 participants 2 messages Jan 19, 2024 – Jan 25, 2024

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

PATCH 1/1 leds: aw200xx: make read-only array coeff_table static const

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

---
 drivers/leds/leds-aw200xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-aw200xx.c +1 -1
index f584a7f98fc5..6c8c9f2c19e3 100644
@@ -282,7 +282,7 @@ static int aw200xx_set_imax(const struct aw200xx *const chip,
 			    u32 led_imax_uA)
 {
 	u32 g_imax_uA = aw200xx_imax_to_global(chip, led_imax_uA);
-	u32 coeff_table[] = {1, 2, 3, 4, 6, 8, 12, 16};
+	static const u32 coeff_table[] = {1, 2, 3, 4, 6, 8, 12, 16};
 	u32 gccr_imax = UINT_MAX;
 	u32 cur_imax = 0;
 	int i;
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw

Re: (subset) [PATCH][next] leds: aw200xx: make read-only array coeff_table static const

Quoted 4 lines · Colin Ian King

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

Applied, thanks!

[1/1] leds: aw200xx: make read-only array coeff_table static const

      commit: bcc7f2ee83dc1dace6eeb6b25014f253ca2a2a51

--
Lee Jones [李琼斯]