Skip to contentSkip to conversation

thermal/drivers/mediatek/lvts_thermal: make read-only arrays static const

PATCH Applied Colin Ian King 3 participants 3 messages Oct 22, 2024 – Oct 28, 2024

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

PATCH 1/1 thermal/drivers/mediatek/lvts_thermal: make read-only arrays static const

Don't populate the read-only arrays on the stack at run time, instead make them static const.

---
 drivers/thermal/mediatek/lvts_thermal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/mediatek/lvts_thermal.c +2 -2
index 1997e91bb3be..ce223bab6b55 100644
@@ -329,7 +329,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
 
 static void lvts_update_irq_mask(struct lvts_ctrl *lvts_ctrl)
 {
-	u32 masks[] = {
+	static const u32 masks[] = {
 		LVTS_MONINT_OFFSET_SENSOR0,
 		LVTS_MONINT_OFFSET_SENSOR1,
 		LVTS_MONINT_OFFSET_SENSOR2,
@@ -424,7 +424,7 @@ static irqreturn_t lvts_ctrl_irq_handler(struct lvts_ctrl *lvts_ctrl)
 {
 	irqreturn_t iret = IRQ_NONE;
 	u32 value;
-	u32 masks[] = {
+	static const u32 masks[] = {
 		LVTS_INT_SENSOR0,
 		LVTS_INT_SENSOR1,
 		LVTS_INT_SENSOR2,
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Colin Ian King

Don't populate the read-only arrays on the stack at run time, instead make them static const.

Quoted 30 lines
---
 drivers/thermal/mediatek/lvts_thermal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/mediatek/lvts_thermal.c +2 -2
index 1997e91bb3be..ce223bab6b55 100644
@@ -329,7 +329,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
 
 static void lvts_update_irq_mask(struct lvts_ctrl *lvts_ctrl)
 {
-	u32 masks[] = {
+	static const u32 masks[] = {
 		LVTS_MONINT_OFFSET_SENSOR0,
 		LVTS_MONINT_OFFSET_SENSOR1,
 		LVTS_MONINT_OFFSET_SENSOR2,
@@ -424,7 +424,7 @@ static irqreturn_t lvts_ctrl_irq_handler(struct lvts_ctrl *lvts_ctrl)
 {
 	irqreturn_t iret = IRQ_NONE;
 	u32 value;
-	u32 masks[] = {
+	static const u32 masks[] = {
 		LVTS_INT_SENSOR0,
 		LVTS_INT_SENSOR1,
 		LVTS_INT_SENSOR2,
Signature · 1 line
2.39.5
#2 lore raw
In reply to Colin Ian King
Quoted 5 lines · Colin Ian King

Don't populate the read-only arrays on the stack at run time, instead make them static const.

---

Applied, thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog