Skip to contentSkip to conversation

rsxx: Remove unnecessary parentheses

PATCH In review Nathan Chancellor 3 participants 3 messages Sep 11, 2018 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rsxx: Remove unnecessary parentheses

Clang warns when more than one set of parentheses is used for a single conditional statement:

drivers/block/rsxx/cregs.c:279:15: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]

        if ((cmd->op == CREG_OP_READ)) {
             ~~~~~~~~^~~~~~~~~~~~~~~

drivers/block/rsxx/cregs.c:279:15: note: remove extraneous parentheses around the comparison to silence this warning
if ((cmd->op == CREG_OP_READ)) {
~ ^ ~
drivers/block/rsxx/cregs.c:279:15: note: use '=' to turn this equality comparison into an assignment

        if ((cmd->op == CREG_OP_READ)) {
                     ^~
                     =

1 warning generated.

---
 drivers/block/rsxx/cregs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rsxx/cregs.c +1 -1
index c148e83e4ed7..d9a8758682c9 100644
@@ -276,7 +276,7 @@ static void creg_cmd_done(struct work_struct *work)
 		st = -EIO;
 	}
 
-	if ((cmd->op == CREG_OP_READ)) {
+	if (cmd->op == CREG_OP_READ) {
 		unsigned int cnt8 = ioread32(card->regmap + CREG_CNT);
 
 		/* Paranoid Sanity Checks */
Signature · 1 line
2.18.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 39 lines · Nathan Chancellor

Clang warns when more than one set of parentheses is used for a single conditional statement:

drivers/block/rsxx/cregs.c:279:15: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]

        if ((cmd->op == CREG_OP_READ)) {
             ~~~~~~~~^~~~~~~~~~~~~~~

drivers/block/rsxx/cregs.c:279:15: note: remove extraneous parentheses around the comparison to silence this warning
if ((cmd->op == CREG_OP_READ)) {
~ ^ ~
drivers/block/rsxx/cregs.c:279:15: note: use '=' to turn this equality comparison into an assignment

        if ((cmd->op == CREG_OP_READ)) {
                     ^~
                     =

1 warning generated.

---
 drivers/block/rsxx/cregs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/rsxx/cregs.c +1 -2
index c148e83e4ed7..d9a8758682c9 100644
@@ -276,7 +276,7 @@ static void creg_cmd_done(struct work_struct *work)
                st = -EIO;
        }
 
-       if ((cmd->op == CREG_OP_READ)) {
+       if (cmd->op == CREG_OP_READ) {
                unsigned int cnt8 = ioread32(card->regmap + CREG_CNT);
 
                /* Paranoid Sanity Checks */
--
Quoted 2 lines

2.18.0

LGTM

Signature · 2 lines
Thanks,
~Nick Desaulniers
maintainer
#2 lore raw
In reply to Nathan Chancellor
Quoted 13 lines · Nathan Chancellor

Clang warns when more than one set of parentheses is used for a single conditional statement:

drivers/block/rsxx/cregs.c:279:15: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]

        if ((cmd->op == CREG_OP_READ)) {
             ~~~~~~~~^~~~~~~~~~~~~~~

drivers/block/rsxx/cregs.c:279:15: note: remove extraneous parentheses around the comparison to silence this warning
if ((cmd->op == CREG_OP_READ)) {
~ ^ ~
drivers/block/rsxx/cregs.c:279:15: note: use '=' to turn this equality comparison into an assignment

Quoted 4 lines
        if ((cmd->op == CREG_OP_READ)) {
                     ^~
                     =

1 warning generated.

Applied for 4.20, thanks.

Signature · 1 line
Jens Axboe