staging: lustre: Fix warnings in llite_lib.c
cover staging: lustre: Fix warnings in llite_lib.c
This patchset cleans llite_lib.c by fixing checkpatch.pl warnings such as:
prefer kstrtol to sscanf, remove braces in if-else with oneline statements, remove space in function call and at the end of a line.
Navya Sri Nizamkari (4):
staging: lustre: Use kstrtol instead of sscanf.
staging: lustre: Remove unnecessary braces.
staging: lustre: Remove whitespace.
staging: lustre: Remove space in function call.
drivers/staging/lustre/lustre/llite/llite_lib.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/4 staging: lustre: Use kstrtol instead of sscanf.
Parsing error in sscanf returns a zero, while kstrtol returns non-zero.This patch changes sscanf into kstrtol by making appropriate changes in the case of parsing error conditional check to fix the following checkpatch.pl warning:
WARNING: Prefer kstrto<type> to single variable sscanf
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
@@ -2150,7 +2150,7 @@ 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 ) +if (kstrtol (ptr,0 , &x))return -EINVAL ; sb = (void *)x;/* This better be a real Lustre superblock! */
Signature · 1 line
1.9.1
PATCH 2/4 staging: lustre: Remove unnecessary braces.
In reply to Navya Sri NizamkariThis patch fixes the following checkpatch.pl warning:
WARNING: braces {} are not necessary for any arm of this statement.
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -3
@@ -87,11 +87,10 @@ static struct ll_sb_info *ll_init_sbi(void)si_meminfo (&si); pages = si.totalram - si.totalhigh; -if (pages >> (20 -PAGE_CACHE_SHIFT ) <512 ) { +if (pages >> (20 -PAGE_CACHE_SHIFT ) <512 ) lru_page_max = pages /2 ; - }else { +else lru_page_max = (pages /4 ) *3 ; - }/* initialize lru data */ atomic_set (&sbi->ll_cache.ccc_users,0 );
Signature · 1 line
1.9.1
PATCH 3/4 staging: lustre: Remove whitespace.
In reply to Navya Sri NizamkariThis patch fixes the following checkpatch.pl warning:
WARNING: unnecessary whitespace before a quoted newline
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
@@ -620,7 +620,7 @@ int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize) rc =obd_get_info (NULL , sbi->ll_md_exp,sizeof (KEY_MAX_EASIZE ),KEY_MAX_EASIZE , &size, lmmsize,NULL );if (rc) -CERROR ("Get max mdsize error rc %d \n" , rc); +CERROR ("Get max mdsize error rc %d\n" , rc);return rc; }
Signature · 1 line
1.9.1
PATCH 4/4 staging: lustre: Remove space in function call.
In reply to Navya Sri NizamkariThis patch fixes the following checkpatch.pl warning:
WARNING: space prohibited between function name and open parenthesis '('
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +1 -1
@@ -1605,7 +1605,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)struct lov_stripe_md *lsm = md->lsm;struct ll_sb_info *sbi =ll_i2sbi (inode); -LASSERT ((lsm !=NULL ) == ((body->valid &OBD_MD_FLEASIZE ) !=0 )); +LASSERT ((lsm !=NULL ) == ((body->valid &OBD_MD_FLEASIZE ) !=0 ));if (lsm !=NULL ) {if (!lli->lli_has_smd && !(sbi->ll_flags &LL_SBI_LAYOUT_LOCK ))
Signature · 1 line
1.9.1
Greg KH
maintainerRe: [Outreachy kernel] [PATCH 1/4] staging: lustre: Use kstrtol instead of sscanf.
In reply to Navya Sri NizamkariQuoted 27 lines · Navya Sri Nizamkari
Parsing error in sscanf returns a zero, while kstrtol returns non-zero.This patch changes sscanf into kstrtol by making appropriate changes in the case of parsing error conditional check to fix the following checkpatch.pl warning:
WARNING: Prefer kstrto<type> to single variable sscanf
Signed-off-by Navya Sri Nizamkari <[email protected]>--- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lustre/llite/llite_lib.c +1
-1@@ -2150,7 +2150,7 @@ 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 ) +if (kstrtol (ptr,0 , &x))return -EINVAL ; sb = (void *)x;/* This better be a real Lustre superblock! */ Signature · 1 line
1.9.1
This doesn't apply to my tree :(
Greg KH
maintainerRe: [Outreachy kernel] [PATCH 2/4] staging: lustre: Remove unnecessary braces.
In reply to Navya Sri NizamkariQuoted 30 lines · Navya Sri Nizamkari
This patch fixes the following checkpatch.pl warning:
WARNING: braces {} are not necessary for any arm of this statement.
Signed-off-by Navya Sri Nizamkari <[email protected]>--- drivers/staging/lustre/lustre/llite/llite_lib.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/staging/lustre/lustre/llite/llite_lib.c +2
-3@@ -87,11 +87,10 @@ static struct ll_sb_info *ll_init_sbi(void)si_meminfo (&si); pages = si.totalram - si.totalhigh; -if (pages >> (20 -PAGE_CACHE_SHIFT ) <512 ) { +if (pages >> (20 -PAGE_CACHE_SHIFT ) <512 ) lru_page_max = pages /2 ; - }else { +else lru_page_max = (pages /4 ) *3 ; - }/* initialize lru data */ atomic_set (&sbi->ll_cache.ccc_users,0 );Signature · 1 line
1.9.1
Does not apply :(
Greg KH
maintainerRe: [Outreachy kernel] [PATCH 3/4] staging: lustre: Remove whitespace.
In reply to Navya Sri NizamkariQuoted 14 lines · Navya Sri Nizamkari
This patch fixes the following checkpatch.pl warning:
WARNING: unnecessary whitespace before a quoted newline
Signed-off-by Navya Sri Nizamkari <[email protected]>--- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/lustre/lustre/llite/llite_lib.c +0
-0
drivers/staging/lustre/lustre/llite/llite_lib.c int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize) · line 626
Quoted 8 lines
drivers/staging/lustre/lustre/llite/llite_lib.c +1
-1@@ -620,7 +620,7 @@ int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize) rc =obd_get_info (NULL , sbi->ll_md_exp,sizeof (KEY_MAX_EASIZE ),KEY_MAX_EASIZE , &size, lmmsize,NULL );if (rc) -CERROR ("Get max mdsize error rc %d \n" , rc); +CERROR ("Get max mdsize error rc %d\n" , rc);return rc; }
Does not apply :(