Staging: lustre: Change char * array type as static const
PATCH 1/1 Staging: lustre: Change char * array type as static const
WARNING: char * array declaration might be better as static const. That was found by running checkpatch.
After this exchange that can be accessed pointer, without object derived from the instance but just just read operation can be done in pointer.
--- drivers/staging/lustre/lustre/ptlrpc/import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/ptlrpc/import.c +1 -1
@@ -623,7 +623,7 @@ int ptlrpc_connect_import(struct obd_import *imp)int set_transno =0 ;__u64 committed_before_reconnect =0 ;struct ptlrpc_request *request; -char *bufs[] = {NULL , +static const char const *bufs[] = {NULL ,obd2cli_tgt (imp->imp_obd), obd->obd_uuid.uuid, (char *)&imp->imp_dlm_handle,
Signature · 1 line
1.8.3.2
Quoted 16 lines · Melike Yurtoglu
WARNING: char * array declaration might be better as static const. That was found by running checkpatch.
After this exchange that can be accessed pointer, without object derived from the instance but just just read operation can be done in pointer.Signed-off-by Melike Yurtoglu <[email protected]>--- drivers/staging/lustre/lustre/ptlrpc/import.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lustre/ptlrpc/import.c +0
-0
drivers/staging/lustre/lustre/ptlrpc/import.c int ptlrpc_connect_import(struct obd_import *imp) · line 629
Quoted 8 lines
drivers/staging/lustre/lustre/ptlrpc/import.c +1
-1@@ -623,7 +623,7 @@ int ptlrpc_connect_import(struct obd_import *imp)int set_transno =0 ;__u64 committed_before_reconnect =0 ;struct ptlrpc_request *request; -char *bufs[] = {NULL , +static const char const *bufs[] = {NULL ,obd2cli_tgt (imp->imp_obd), obd->obd_uuid.uuid, (char *)&imp->imp_dlm_handle,
If a local variable is static, then its value is accumulated from one call to the next. It's initializer is only evaluated on the first call. Is that going to give the correct behavior here? For example, does obd->obd_uuid.uuid have the same value on every call? If this is the case, the reason why has to be explained more carefully in the commit message.
julia
Quoted 10 lines
--
1.8.3.2--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1425067393-26435-1-git-send-email-aysemelikeyurtoglu%40gmail.com.
For more options, visit https://groups.google.com/d/optout.