* [PATCH] Staging: lustre: Remove unnecessary else after return
@ 2015-03-01 4:59 Haneen Mohammed
2015-03-02 0:48 ` [Outreachy kernel] " Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Haneen Mohammed @ 2015-03-01 4:59 UTC (permalink / raw)
To: outreachy-kernel; +Cc: 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 <hamohammed.sa@gmail.com>
---
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 28 ++++++++++++-------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index cd15445..ad68e66 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -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);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Outreachy kernel] [PATCH] Staging: lustre: Remove unnecessary else after return
2015-03-01 4:59 [PATCH] Staging: lustre: Remove unnecessary else after return Haneen Mohammed
@ 2015-03-02 0:48 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2015-03-02 0:48 UTC (permalink / raw)
To: Haneen Mohammed; +Cc: outreachy-kernel
On Sun, Mar 01, 2015 at 07:59:31AM +0300, Haneen Mohammed wrote:
> 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 <hamohammed.sa@gmail.com>
> ---
> drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 28 ++++++++++++-------------
> 1 file changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
> index cd15445..ad68e66 100644
> --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
> +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
> @@ -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.
> +
> 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;
I see what you are trying to do here, but it might be better just to
leave this alone.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Staging: lustre: Remove unnecessary else after return
@ 2015-02-20 21:05 aybuke ozdemir
2015-02-20 21:16 ` [Outreachy kernel] " Jes Sorensen
0 siblings, 1 reply; 3+ messages in thread
From: aybuke ozdemir @ 2015-02-20 21:05 UTC (permalink / raw)
To: outreachy-kernel; +Cc: aybuke ozdemir
This patch fixes "else is not generally useful after
a break or return" checkpatch.pl warning using goto statement in lcommon_cl.c
Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
---
drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index 23095bb..b8311c6 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -834,7 +834,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
size_index < cur_index)
*exceed = 1;
}
- return result;
+ goto out;
} else {
/*
* region is within kms and, hence, within real file
@@ -857,6 +857,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
}
}
ccc_object_size_unlock(obj);
+out:
return result;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [Outreachy kernel] [PATCH] Staging: lustre: Remove unnecessary else after return
2015-02-20 21:05 aybuke ozdemir
@ 2015-02-20 21:16 ` Jes Sorensen
0 siblings, 0 replies; 3+ messages in thread
From: Jes Sorensen @ 2015-02-20 21:16 UTC (permalink / raw)
To: aybuke ozdemir, outreachy-kernel
On 02/20/15 16:05, aybuke ozdemir wrote:
> This patch fixes "else is not generally useful after
> a break or return" checkpatch.pl warning using goto statement in lcommon_cl.c
>
> Signed-off-by: aybuke ozdemir <aybuke.147@gmail.com>
> ---
> drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Looks good to me.
Jes
> diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> index 23095bb..b8311c6 100644
> --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
> @@ -834,7 +834,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
> size_index < cur_index)
> *exceed = 1;
> }
> - return result;
> + goto out;
> } else {
> /*
> * region is within kms and, hence, within real file
> @@ -857,6 +857,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,
> }
> }
> ccc_object_size_unlock(obj);
> +out:
> return result;
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-02 0:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-01 4:59 [PATCH] Staging: lustre: Remove unnecessary else after return Haneen Mohammed
2015-03-02 0:48 ` [Outreachy kernel] " Greg KH
-- strict thread matches above, loose matches on Subject: below --
2015-02-20 21:05 aybuke ozdemir
2015-02-20 21:16 ` [Outreachy kernel] " Jes Sorensen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.