Skip to contentSkip to conversation

Staging: unisys: Change char * array type as static const

PATCH In review aybuke ozdemir 2 participants 2 messages Feb 24, 2015 – Feb 26, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Staging: unisys: Change char * array type as static const

This patch fixes "char * array declaration might be better as static const" checkpatch.pl warning in visorchipset_main.c
After this exchange that can be accessed pointer, without object derived from the instance but just just read operation can be done in pointer.

---
Changes since v1:
* Used "static const char *const" instead of "static char const"

---
 drivers/staging/unisys/visorchipset/visorchipset_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/unisys/visorchipset/visorchipset_main.c +3 -3
index f606ee9..7e97b8e 100644
@@ -1009,7 +1009,7 @@ device_epilog(u32 busNo, u32 devNo, struct spar_segment_state state, u32 cmd,
 
 	struct visorchipset_device_info *pDevInfo =
 		finddevice(&DevInfoList, busNo, devNo);
-	char *envp[] = {
+	static const char *const envp[] = {
 		"SPARSP_DIAGPOOL_PAUSED_STATE = 1",
 		NULL
 	};
@@ -1481,7 +1481,7 @@ int
 visorchipset_chipset_selftest(void)
 {
 	char env_selftest[20];
-	char *envp[] = { env_selftest, NULL };
+	static const char *const envp[] = { env_selftest, NULL };
 
 	sprintf(env_selftest, "SPARSP_SELFTEST=%d", 1);
 	kobject_uevent_env(&Visorchipset_platform_device.dev.kobj, KOBJ_CHANGE,
@@ -1637,7 +1637,7 @@ parahotplug_request_kickoff(struct parahotplug_request *req)
 	struct controlvm_message_packet *cmd = &req->msg.cmd;
 	char env_cmd[40], env_id[40], env_state[40], env_bus[40], env_dev[40],
 	    env_func[40];
-	char *envp[] = {
+	static const char *const envp[] = {
 		env_cmd, env_id, env_state, env_bus, env_dev, env_func, NULL
 	};
 
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 6 lines · aybuke ozdemir

This patch fixes "char * array declaration might be better as static const" checkpatch.pl warning in visorchipset_main.c
After this exchange that can be accessed pointer, without object derived from the instance but just just read operation can be done in pointer.

Quoted 7 lines

---
Changes since v1:
* Used "static const char *const" instead of "static char const"

---
 drivers/staging/unisys/visorchipset/visorchipset_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Please _always_ compile your changes, this one broke the build so badly that is is obvious you didn't even try to build it :(