[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tencent_67481983755837947ADD1DAD8BB36FEF880A@qq.com>
Date: Thu, 13 Nov 2025 20:52:52 +0800
From: Chang Junzheng <guagua210311@...com>
To: outreachy@...ts.linux.dev
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
guagua210311@...com,
Chang Junzheng <guagua210311@...look.com>
Subject: [PATCH] staging: greybus: audio_manager_module: make envp array static const
From: Chang Junzheng <guagua210311@...look.com>
The envp array in send_add_uevent() function is declared as a non-const
local array, which triggers the following checkpatch.pl warning:
WARNING: char * array declaration might be better as static const
Change the declaration to 'static const char * const' to improve code
safety by making the array read-only and allow for better compiler
optimization. This follows the kernel coding style recommendations.
Signed-off-by: Chang Junzheng <guagua210311@...com>
---
drivers/staging/greybus/audio_manager_module.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/greybus/audio_manager_module.c b/drivers/staging/greybus/audio_manager_module.c
index 4a4dfb42f50f..ca6a2cd0bc4f 100644
--- a/drivers/staging/greybus/audio_manager_module.c
+++ b/drivers/staging/greybus/audio_manager_module.c
@@ -159,14 +159,14 @@ static void send_add_uevent(struct gb_audio_manager_module *module)
char ip_devices_string[64];
char op_devices_string[64];
- char *envp[] = {
- name_string,
- vid_string,
- pid_string,
- intf_id_string,
- ip_devices_string,
- op_devices_string,
- NULL
+ static const char * const envp[] = {
+ name_string,
+ vid_string,
+ pid_string,
+ intf_id_string,
+ ip_devices_string,
+ op_devices_string,
+ NULL
};
snprintf(name_string, 128, "NAME=%s", module->desc.name);
--
2.43.0
Powered by blists - more mailing lists