Skip to contentSkip to conversation

hwmon: nzxt-smart2: make array detect_fans_report static const

PATCH Applied Colin Ian King 2 participants 2 messages Jan 9, 2022 – Jan 10, 2022

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

PATCH 1/1 hwmon: nzxt-smart2: make array detect_fans_report static const

Don't populate the read-only array detect_fans_report on the stack but instead it static const. Also makes the object code a little smaller.

---
 drivers/hwmon/nzxt-smart2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/nzxt-smart2.c +1 -1
index 6e67da766969..dd892ff5a3e8 100644
@@ -583,7 +583,7 @@ static int set_update_interval(struct drvdata *drvdata, long val)
 static int init_device(struct drvdata *drvdata, long update_interval)
 {
 	int ret;
-	u8 detect_fans_report[] = {
+	static const u8 detect_fans_report[] = {
 		OUTPUT_REPORT_ID_INIT_COMMAND,
 		INIT_COMMAND_DETECT_FANS,
 	};
Signature · 1 line
2.33.1
maintainer Applied
#1 lore raw
Quoted 4 lines · Colin Ian King

Don't populate the read-only array detect_fans_report on the stack but instead it static const. Also makes the object code a little smaller.

Applied.

Thanks,
Guenter

Quoted 17 lines
---
 drivers/hwmon/nzxt-smart2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/nzxt-smart2.c +1 -1
index 6e67da766969..dd892ff5a3e8 100644
@@ -583,7 +583,7 @@ static int set_update_interval(struct drvdata *drvdata, long val)
 static int init_device(struct drvdata *drvdata, long update_interval)
 {
 	int ret;
-	u8 detect_fans_report[] = {
+	static const u8 detect_fans_report[] = {
 		OUTPUT_REPORT_ID_INIT_COMMAND,
 		INIT_COMMAND_DETECT_FANS,
 	};