diff mbox series

[next] hwmon: nzxt-smart2: make array detect_fans_report static const

Message ID 20220109194558.45811-1-colin.i.king@gmail.com (mailing list archive)
State Accepted
Headers show
Series [next] hwmon: nzxt-smart2: make array detect_fans_report static const | expand

Commit Message

Colin Ian King Jan. 9, 2022, 7:45 p.m. UTC
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.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/hwmon/nzxt-smart2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck Jan. 10, 2022, 1:11 a.m. UTC | #1
On Sun, Jan 09, 2022 at 07:45:58PM +0000, Colin Ian King wrote:
> 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.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/nzxt-smart2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/nzxt-smart2.c b/drivers/hwmon/nzxt-smart2.c
> index 6e67da766969..dd892ff5a3e8 100644
> --- a/drivers/hwmon/nzxt-smart2.c
> +++ b/drivers/hwmon/nzxt-smart2.c
> @@ -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,
>  	};
diff mbox series

Patch

diff --git a/drivers/hwmon/nzxt-smart2.c b/drivers/hwmon/nzxt-smart2.c
index 6e67da766969..dd892ff5a3e8 100644
--- a/drivers/hwmon/nzxt-smart2.c
+++ b/drivers/hwmon/nzxt-smart2.c
@@ -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,
 	};