Skip to contentSkip to conversation

staging: greybus: Change NULL comparison to Boolean Negation

PATCH In review Nishka Dasgupta 3 participants 4 messages Mar 4, 2019 – Mar 19, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: greybus: Change NULL comparison to Boolean Negation

Change NULL comparison to boolean negation. Issue found by Checkpatch.

---
 drivers/staging/greybus/bundle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/bundle.c +1 -1
index e97b2b87ba47..376ca53f0d83 100644
@@ -32,7 +32,7 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr,
 {
 	struct gb_bundle *bundle = to_gb_bundle(dev);
 
-	if (bundle->state == NULL)
+	if (!(bundle->state))
 		return sprintf(buf, "\n");
 
 	return sprintf(buf, "%s\n", bundle->state);
Signature · 1 line
2.19.1
maintainer
#1 lore raw
Quoted 12 lines · Nishka Dasgupta

Change NULL comparison to boolean negation. Issue found by Checkpatch.

---
 drivers/staging/greybus/bundle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/bundle.c +0 -0
index e97b2b87ba47..376ca53f0d83 100644

drivers/staging/greybus/bundle.c static ssize_t state_show(struct device *dev, struct device_attribute *attr, · line 35

Quoted 5 lines
drivers/staging/greybus/bundle.c +1 -1
@@ -32,7 +32,7 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr,
 {
 	struct gb_bundle *bundle = to_gb_bundle(dev);
 
-	if (bundle->state == NULL)
+	if (!(bundle->state))

I noticed Greg already picked this one up, but there's no need for parenthesis around bundle->state here (cf. state_store()).

drivers/staging/greybus/bundle.c static ssize_t state_show(struct device *dev, struct device_attribute *attr, · line 38

Quoted 3 lines
drivers/staging/greybus/bundle.c +0 -0
 		return sprintf(buf, "\n");
 
 	return sprintf(buf, "%s\n", bundle->state);

Johan

#2 lore raw
Quoted 16 lines · Johan Hovold
Quoted 15 lines · Nishka Dasgupta

Change NULL comparison to boolean negation. Issue found by Checkpatch.

---
  drivers/staging/greybus/bundle.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/greybus/bundle.c +0 -0
index e97b2b87ba47..376ca53f0d83 100644
@@ -32,7 +32,7 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr,
  {
  	struct gb_bundle *bundle = to_gb_bundle(dev);
 
Quoted 5 lines

drivers/staging/greybus/bundle.c static ssize_t state_show(struct device *dev, struct device_attribute *attr, · line 35

Quoted 2 lines
drivers/staging/greybus/bundle.c +1 -1
-	if (bundle->state == NULL)
+	if (!(bundle->state))

I noticed Greg already picked this one up, but there's no need for parenthesis around bundle->state here (cf. state_store()).

Okay, I'll keep that in mind.
Thanking you,
Nishka

Quoted 6 lines

drivers/staging/greybus/bundle.c static ssize_t state_show(struct device *dev, struct device_attribute *attr, · line 38

Quoted 3 lines
drivers/staging/greybus/bundle.c +0 -0
  		return sprintf(buf, "\n");
 
  	return sprintf(buf, "%s\n", bundle->state);

Johan

#3 lore raw
Quoted 25 lines · NIshka Dasgupta' via outreachy-kernel
Quoted 8 lines · Johan Hovold
Quoted 7 lines · Nishka Dasgupta

Change NULL comparison to boolean negation. Issue found by Checkpatch.

---
  drivers/staging/greybus/bundle.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/staging/greybus/bundle.c static ssize_t state_show(struct device *dev, struct · line 36

Quoted 11 lines
drivers/staging/greybus/bundle.c +1 -0
index e97b2b87ba47..376ca53f0d83 100644
@@ -32,7 +32,7 @@ static ssize_t state_show(struct device *dev, struct
 device_attribute *attr,
  {
  	struct gb_bundle *bundle = to_gb_bundle(dev);
  -	if (bundle->state == NULL)
+	if (!(bundle->state))

I noticed Greg already picked this one up, but there's no need for parenthesis around bundle->state here (cf. state_store()).

Quoted 1 line

Okay, I'll keep that in mind.

Since Greg picked it up, you can send another patch that fixes the issue.

julia

Quoted 18 lines

Thanking you,
Nishka

Quoted 5 lines

drivers/staging/greybus/bundle.c static ssize_t state_show(struct device *dev, struct device_attribute *attr, · line 38

Quoted 2 lines
drivers/staging/greybus/bundle.c +0 -0
  		return sprintf(buf, "\n");
    	return sprintf(buf, "%s\n", bundle->state);

Johan

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/3cecf381-0230-400c-d0c4-5aed1134e62d%40yahoo.com.
For more options, visit https://groups.google.com/d/optout.