Staging: lustre: Remove unnecessary else after return
PATCH 1/1 Staging: lustre: Remove unnecessary else after return
This patch fix else is not usefull after break or return. Moves declaration to top addressing compiler warning:
"ISO C90 forbids mixed declarations and code" Rename similar named variable in the function.
--- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 28 ++++++++++++------------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +13 -15
@@ -444,28 +444,26 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns, struct list_head *cancels, int count, ldlm_cancel_flags_t cancel_flags) { + struct ldlm_bl_work_item blwi, *pblwi; +if (cancels && count ==0 )return 0 ;if (cancel_flags &LCF_ASYNC ) { - struct ldlm_bl_work_item *blwi; - -OBD_ALLOC (blwi,sizeof (*blwi)); -if (blwi ==NULL ) +OBD_ALLOC (pblwi,sizeof (*pblwi)); +if (pblwi ==NULL )return -ENOMEM ; -init_blwi (blwi, ns, ld, cancels, count, lock, cancel_flags); +init_blwi (pblwi, ns, ld, cancels, count, lock, cancel_flags); -return __ldlm_bl_to_thread (blwi, cancel_flags); - } else { -/* if it is synchronous call do minimum mem alloc, as it could -* be triggered from kernel shrinker -*/ -struct ldlm_bl_work_item blwi; - -memset (&blwi,0 ,sizeof (blwi)); -init_blwi (&blwi, ns, ld, cancels, count, lock, cancel_flags); -return __ldlm_bl_to_thread (&blwi, cancel_flags); +return __ldlm_bl_to_thread (pblwi, cancel_flags); } +/* if it is synchronous call do minimum mem alloc, as it could +* be triggered from kernel shrinker +*/ + +memset (&blwi,0 ,sizeof (blwi)); +init_blwi (&blwi, ns, ld, cancels, count, lock, cancel_flags); +return __ldlm_bl_to_thread (&blwi, cancel_flags); }
Signature · 1 line
1.9.1
Greg KH
maintainerQuoted 15 lines · Haneen Mohammed
This patch fix else is not usefull after break or return. Moves declaration to top addressing compiler warning:
"ISO C90 forbids mixed declarations and code" Rename similar named variable in the function.Signed-off-by Haneen Mohammed <[email protected]>--- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 28 ++++++++++++------------- 1 file changed, 13 insertions(+), 15 deletions(-)drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +0
-0
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c static int ldlm_bl_to_thread(struct ldlm_namespace *ns, · line 447
Quoted 4 lines
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +1
-0@@ -444,28 +444,26 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns, struct list_head *cancels, int count, ldlm_cancel_flags_t cancel_flags) { + struct ldlm_bl_work_item blwi, *pblwi;
Ick, don't use 'p' to define a pointer.
Quoted 11 lines
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +3
-4+if (cancels && count ==0 )return 0 ;if (cancel_flags &LCF_ASYNC ) { -struct ldlm_bl_work_item *blwi; - -OBD_ALLOC (blwi,sizeof (*blwi)); -if (blwi ==NULL ) +OBD_ALLOC (pblwi,sizeof (*pblwi)); +if (pblwi ==NULL )
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c static int ldlm_bl_to_thread(struct ldlm_namespace *ns, · line 463
Quoted 10 lines
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +1
-7return -ENOMEM ; -init_blwi (blwi, ns, ld, cancels, count, lock, cancel_flags); +init_blwi (pblwi, ns, ld, cancels, count, lock, cancel_flags); -return __ldlm_bl_to_thread (blwi, cancel_flags); - }else { -/* if it is synchronous call do minimum mem alloc, as it could -* be triggered from kernel shrinker -*/ -struct ldlm_bl_work_item blwi;
I see what you are trying to do here, but it might be better just to leave this alone.
thanks,
greg k-h