[OPW,kernel,2/7] Staging: lustre: Fix no use of assignment in if condition
diff mbox

Message ID a7d567f0bd336e13bf9d90d71b4ca7a69c551d8c.1382737168.git.rashika.kheria@gmail.com
State Changes Requested
Headers show

Commit Message

Rashika Oct. 25, 2013, 9:42 p.m. UTC
This patch fixes the following checkpatch.pl warning in lustre/ldlm/inteval_tree.c-
ERROR: do not use assignment in if condition

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---
 drivers/staging/lustre/lustre/ldlm/interval_tree.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Waskiewicz Jr, Peter P Oct. 25, 2013, 11:40 p.m. UTC | #1
On Sat, 2013-10-26 at 03:12 +0530, Rashika Kheria wrote:
> This patch fixes the following checkpatch.pl warning in lustre/ldlm/inteval_tree.c-

Fix the spelling here, it should be interval_tree.c

> ERROR: do not use assignment in if condition
> 
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> ---
>  drivers/staging/lustre/lustre/ldlm/interval_tree.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/ldlm/interval_tree.c b/drivers/staging/lustre/lustre/ldlm/interval_tree.c
> index ced3355..dd72fd5 100644
> --- a/drivers/staging/lustre/lustre/ldlm/interval_tree.c
> +++ b/drivers/staging/lustre/lustre/ldlm/interval_tree.c
> @@ -427,7 +427,7 @@ static void interval_erase_color(struct interval_node *node,
>  			} else {
>  				if (node_is_black_or_0(tmp->in_right)) {
>  					struct interval_node *o_left;
> -					if ((o_left = tmp->in_left))
> +					if ((o_left == tmp->in_left))

The second set of parentheses are unnecessary here.

>  						o_left->in_color = INTERVAL_BLACK;
>  					tmp->in_color = INTERVAL_RED;
>  					__rotate_right(tmp, root);
> @@ -457,7 +457,7 @@ static void interval_erase_color(struct interval_node *node,
>  			} else {
>  				if (node_is_black_or_0(tmp->in_left)) {
>  					struct interval_node *o_right;
> -					if ((o_right = tmp->in_right))
> +					if ((o_right == tmp->in_right))

Same here.

>  						o_right->in_color = INTERVAL_BLACK;
>  					tmp->in_color = INTERVAL_RED;
>  					__rotate_left(tmp, root);
> -- 
> 1.7.9.5
>

Patch
diff mbox

diff --git a/drivers/staging/lustre/lustre/ldlm/interval_tree.c b/drivers/staging/lustre/lustre/ldlm/interval_tree.c
index ced3355..dd72fd5 100644
--- a/drivers/staging/lustre/lustre/ldlm/interval_tree.c
+++ b/drivers/staging/lustre/lustre/ldlm/interval_tree.c
@@ -427,7 +427,7 @@  static void interval_erase_color(struct interval_node *node,
 			} else {
 				if (node_is_black_or_0(tmp->in_right)) {
 					struct interval_node *o_left;
-					if ((o_left = tmp->in_left))
+					if ((o_left == tmp->in_left))
 						o_left->in_color = INTERVAL_BLACK;
 					tmp->in_color = INTERVAL_RED;
 					__rotate_right(tmp, root);
@@ -457,7 +457,7 @@  static void interval_erase_color(struct interval_node *node,
 			} else {
 				if (node_is_black_or_0(tmp->in_left)) {
 					struct interval_node *o_right;
-					if ((o_right = tmp->in_right))
+					if ((o_right == tmp->in_right))
 						o_right->in_color = INTERVAL_BLACK;
 					tmp->in_color = INTERVAL_RED;
 					__rotate_left(tmp, root);