All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: most: cdev: Remove unnecessary check
@ 2015-10-15 10:22 Shivani Bhardwaj
  2015-10-15 10:33 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Shivani Bhardwaj @ 2015-10-15 10:22 UTC (permalink / raw)
  To: outreachy-kernel

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

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
---
 drivers/staging/most/aim-cdev/cdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index 930ada0..5dc5608 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: most: cdev: Remove unnecessary check
  2015-10-15 10:22 [PATCH] Staging: most: cdev: Remove unnecessary check Shivani Bhardwaj
@ 2015-10-15 10:33 ` Julia Lawall
  2015-10-15 10:43   ` Shivani Bhardwaj
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2015-10-15 10:33 UTC (permalink / raw)
  To: Shivani Bhardwaj; +Cc: outreachy-kernel

On Thu, 15 Oct 2015, Shivani Bhardwaj wrote:

> 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

>
> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
> ---
>  drivers/staging/most/aim-cdev/cdev.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
> index 930ada0..5dc5608 100644
> --- a/drivers/staging/most/aim-cdev/cdev.c
> +++ b/drivers/staging/most/aim-cdev/cdev.c
> @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: most: cdev: Remove unnecessary check
  2015-10-15 10:33 ` [Outreachy kernel] " Julia Lawall
@ 2015-10-15 10:43   ` Shivani Bhardwaj
  0 siblings, 0 replies; 3+ messages in thread
From: Shivani Bhardwaj @ 2015-10-15 10:43 UTC (permalink / raw)
  To: Julia Lawall; +Cc: outreachy-kernel

On Thu, Oct 15, 2015 at 4:03 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Thu, 15 Oct 2015, Shivani Bhardwaj wrote:
>
>> 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
>

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

>>
>> Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
>> ---
>>  drivers/staging/most/aim-cdev/cdev.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
>> index 930ada0..5dc5608 100644
>> --- a/drivers/staging/most/aim-cdev/cdev.c
>> +++ b/drivers/staging/most/aim-cdev/cdev.c
>> @@ -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 outreachy-kernel+unsubscribe@googlegroups.com.
>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>> 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.
>>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-15 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 10:22 [PATCH] Staging: most: cdev: Remove unnecessary check Shivani Bhardwaj
2015-10-15 10:33 ` [Outreachy kernel] " Julia Lawall
2015-10-15 10:43   ` Shivani Bhardwaj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.