Skip to contentSkip to conversation

bsr: do not use assignment in if condition

PATCH Superseded [email protected] 2 participants 3 messages May 15, 2019 1 message not in the archive Char and misc drivers

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bsr: do not use assignment in if condition

From: Naveen Kumar Parna <[email protected]>

checkpatch.pl does not like assignment in if condition

---
 drivers/char/bsr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/bsr.c +2 -1
index a6cef548e01e..2b00748b83d2 100644
@@ -322,7 +322,8 @@ static int __init bsr_init(void)
 		goto out_err_2;
 	}
 
-	if ((ret = bsr_create_devs(np)) < 0) {
+	ret = bsr_create_devs(np);
+	if (ret  < 0) {
 		np = NULL;
 		goto out_err_3;
 	}
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 14 lines · On Wed, May 15, 2019 at 06:45:24PM +0530, [email protected] wrote:

From: Naveen Kumar Parna <[email protected]>

checkpatch.pl does not like assignment in if condition

---
 drivers/char/bsr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/bsr.c +0 -0
index a6cef548e01e..2b00748b83d2 100644

drivers/char/bsr.c static int __init bsr_init(void) · line 326

Quoted 6 lines
drivers/char/bsr.c +2 -1
@@ -322,7 +322,8 @@ static int __init bsr_init(void)
 		goto out_err_2;
 	}
 
-	if ((ret = bsr_create_devs(np)) < 0) {
+	ret = bsr_create_devs(np);
+	if (ret  < 0) {

Checkpatch also probably does not like that if statement :(

A message that is not in the archive (sent off-list or not yet received): CAKXhv7csf3Qys4KsN+OJuPwb4daakC3U93boUwxd3t-9D9uNQw@mail.gmail.com

maintainer
#3 lore raw
Quoted 27 lines · Naveen Kumar Parna
Quoted 19 lines · Greg KH
Quoted 17 lines · On Wed, May 15, 2019 at 06:45:24PM +0530, [email protected] wrote:

From: Naveen Kumar Parna <[email protected]>

checkpatch.pl does not like assignment in if condition

---
 drivers/char/bsr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/bsr.c +0 -0
index a6cef548e01e..2b00748b83d2 100644
@@ -322,7 +322,8 @@ static int __init bsr_init(void)
              goto out_err_2;
      }
 
Quoted 6 lines

drivers/char/bsr.c static int __init bsr_init(void) · line 326

Quoted 3 lines
drivers/char/bsr.c +2 -1
-     if ((ret = bsr_create_devs(np)) < 0) {
+     ret = bsr_create_devs(np);
+     if (ret  < 0) {

Checkpatch also probably does not like that if statement :(

Quoted 7 lines

I ran checkpatch script and it did not show any warning or error.

$ ./scripts/checkpatch.pl
0001-bsr-do-not-use-assignment-in-if-condition.patch
total: 0 errors, 0 warnings, 9 lines checked
0001-bsr-do-not-use-assignment-in-if-condition.patch has no obvious style
problems and is ready for submission.

Ok, then checkpatch missed it, but your eyes should have caught it.

When you are doing code style fixes outside of the drivers/staging/ area, you need to be very careful to be sure to get it right, as many maintainers do not like the churn.

Please fix this up and resend.

thanks,

greg k-h