public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] ipc: remove unreachable code in sem.c
@ 2009-12-01  6:57 Amerigo Wang
  2009-12-02 22:45 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Amerigo Wang @ 2009-12-01  6:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, Amerigo Wang

This line is unreachable, remove it.

Signed-off-by: WANG Cong <amwang@redhat.com>

---
diff --git a/ipc/sem.c b/ipc/sem.c
index 87c2b64..8439f2f 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -652,7 +652,6 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
 	default:
 		return -EINVAL;
 	}
-	return err;
 out_unlock:
 	sem_unlock(sma);
 	return err;

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

* Re: [Patch] ipc: remove unreachable code in sem.c
  2009-12-01  6:57 [Patch] ipc: remove unreachable code in sem.c Amerigo Wang
@ 2009-12-02 22:45 ` Andrew Morton
  2009-12-03  8:27   ` Cong Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2009-12-02 22:45 UTC (permalink / raw)
  To: Amerigo Wang; +Cc: linux-kernel

On Tue, 1 Dec 2009 01:57:09 -0500
Amerigo Wang <amwang@redhat.com> wrote:

> This line is unreachable, remove it.
> 
> Signed-off-by: WANG Cong <amwang@redhat.com>
> 
> ---
> diff --git a/ipc/sem.c b/ipc/sem.c
> index 87c2b64..8439f2f 100644
> --- a/ipc/sem.c
> +++ b/ipc/sem.c
> @@ -652,7 +652,6 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
>  	default:
>  		return -EINVAL;
>  	}
> -	return err;
>  out_unlock:
>  	sem_unlock(sma);
>  	return err;

If we're going to do that then there's no point in initialising `err':

--- a/ipc/sem.c~ipc-remove-unreachable-code-in-semc-fix
+++ a/ipc/sem.c
@@ -624,7 +624,7 @@ static unsigned long copy_semid_to_user(
 static int semctl_nolock(struct ipc_namespace *ns, int semid,
 			 int cmd, int version, union semun arg)
 {
-	int err = -EINVAL;
+	int err;
 	struct sem_array *sma;
 
 	switch(cmd) {
_


you should have noticed this!

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

* Re: [Patch] ipc: remove unreachable code in sem.c
  2009-12-02 22:45 ` Andrew Morton
@ 2009-12-03  8:27   ` Cong Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Cong Wang @ 2009-12-03  8:27 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Andrew Morton wrote:
> On Tue, 1 Dec 2009 01:57:09 -0500
> Amerigo Wang <amwang@redhat.com> wrote:
> 
>> This line is unreachable, remove it.
>>
>> Signed-off-by: WANG Cong <amwang@redhat.com>
>>
>> ---
>> diff --git a/ipc/sem.c b/ipc/sem.c
>> index 87c2b64..8439f2f 100644
>> --- a/ipc/sem.c
>> +++ b/ipc/sem.c
>> @@ -652,7 +652,6 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
>>  	default:
>>  		return -EINVAL;
>>  	}
>> -	return err;
>>  out_unlock:
>>  	sem_unlock(sma);
>>  	return err;
> 
> If we're going to do that then there's no point in initialising `err':
> 
> --- a/ipc/sem.c~ipc-remove-unreachable-code-in-semc-fix
> +++ a/ipc/sem.c
> @@ -624,7 +624,7 @@ static unsigned long copy_semid_to_user(
>  static int semctl_nolock(struct ipc_namespace *ns, int semid,
>  			 int cmd, int version, union semun arg)
>  {
> -	int err = -EINVAL;
> +	int err;
>  	struct sem_array *sma;
>  
>  	switch(cmd) {
> _
> 
> 
> you should have noticed this!

Oh, I didn't realize that. Thank you!


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

end of thread, other threads:[~2009-12-03  8:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-01  6:57 [Patch] ipc: remove unreachable code in sem.c Amerigo Wang
2009-12-02 22:45 ` Andrew Morton
2009-12-03  8:27   ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox