Skip to contentSkip to conversation

Staging: most: cdev: Remove unnecessary check

PATCH Superseded Shivani Bhardwaj 2 participants 3 messages Oct 15, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: most: cdev: Remove unnecessary check

The variable mbo is already NULL tested so, check on it should be removed.
Semantic patch used:

@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3

---
 drivers/staging/most/aim-cdev/cdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/most/aim-cdev/cdev.c +1 -2
index 930ada0..5dc5608 100644
@@ -207,8 +207,7 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
 	}
 	return actual_len - retval;
 error:
-	if (mbo)
-		most_put_mbo(mbo);
+	most_put_mbo(mbo);
 	return err;
 }
 
Signature · 1 line
2.1.0
#1 lore raw
Quoted 11 lines · Shivani Bhardwaj

The variable mbo is already NULL tested so, check on it should be removed.
Semantic patch used:

@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3

I don't think that this semantic patch actually matches the code below.

julia

Quoted 30 lines
---
 drivers/staging/most/aim-cdev/cdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/most/aim-cdev/cdev.c +1 -3
index 930ada0..5dc5608 100644
@@ -207,8 +207,7 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
 	}
 	return actual_len - retval;
 error:
-	if (mbo)
-		most_put_mbo(mbo);
+	most_put_mbo(mbo);
 	return err;
 }
 
--

2.1.0

--
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/20151015102240.GA17961%40ubuntu.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 14 lines · Julia Lawall
Quoted 11 lines · Shivani Bhardwaj

The variable mbo is already NULL tested so, check on it should be removed.
Semantic patch used:

@@ expression E;
statement S1, S2, S3; @@
if(E==NULL) {... return ...;}
else S1
- if(E==NULL)
S2
- else S3

Quoted 4 lines

I don't think that this semantic patch actually matches the code below.

julia

I'm sorry. I've sent another version. I've tested that on a dummy file. Thank you.

Quoted 30 lines
Quoted 30 lines
---
 drivers/staging/most/aim-cdev/cdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/most/aim-cdev/cdev.c +1 -3
index 930ada0..5dc5608 100644
@@ -207,8 +207,7 @@ static ssize_t aim_write(struct file *filp, const char __user *buf,
      }
      return actual_len - retval;
 error:
-     if (mbo)
-             most_put_mbo(mbo);
+     most_put_mbo(mbo);
      return err;
 }
 
--

2.1.0

--
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/20151015102240.GA17961%40ubuntu.
For more options, visit https://groups.google.com/d/optout.