Staging: lustre: use kstrtoul() instead of sscanf()
PATCH v2 2/3 Staging: lustre: use kstrtoul() instead of sscanf()
This patch makes checkpatch.pl by fixing the following warning:
WARNING: Prefer kstrto<type> to single variable sscanf. I used to kstrtoul can convert unsigned long instead of sscanf
---
Changes since v1:
* Removed unnecessary variable rc1.
* The return value is changed(Returns 0 on success).
* Changed the description
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -1
@@ -2198,7 +2198,8 @@ int ll_process_config(struct lustre_cfg *lcfg) ptr =strrchr (lustre_cfg_string (lcfg,0 ),'-' );if (!ptr || !*(++ptr))return -EINVAL ; -if (sscanf (ptr,"%lx" , &x) !=1 ) + rc =kstrtoul (ptr,16 , &x); +if (rc !=0 )return -EINVAL ; sb = (void *)x;/* This better be a real Lustre superblock! */
Signature · 1 line
1.9.1
Quoted 3 lines · aybuke ozdemir
This patch makes checkpatch.pl by fixing the following warning:
WARNING: Prefer kstrto<type> to single variable sscanf. I used to kstrtoul can convert unsigned long instead of sscanf
This looks better.
This patch is part of a series, so you have to send the whole series again as v2. For the others just put a comment below the --- saying that they have not changed.
julia
Quoted 34 lines
Signed-off-by aybuke ozdemir <[email protected]>---
Changes since v1:
* Removed unnecessary variable rc1.
* The return value is changed(Returns 0 on success).
* Changed the description--- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/staging/lustre/lustre/llite/llite_lib.c +2
-1@@ -2198,7 +2198,8 @@ int ll_process_config(struct lustre_cfg *lcfg) ptr =strrchr (lustre_cfg_string (lcfg,0 ),'-' );if (!ptr || !*(++ptr))return -EINVAL ; -if (sscanf (ptr,"%lx" , &x) !=1 ) + rc =kstrtoul (ptr,16 , &x); +if (rc !=0 )return -EINVAL ; sb = (void *)x;/* This better be a real Lustre superblock! */ Signature · 8 lines
1.9.1 -- 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/1424551663-14662-1-git-send-email-aybuke.147%40gmail.com. For more options, visit https://groups.google.com/d/optout.