Skip to contentSkip to conversation

ipc: remove unreachable code in sem.c

PATCH In review Amerigo Wang 2 participants 3 messages Dec 1, 2009 – Dec 3, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipc: remove unreachable code in sem.c

This line is unreachable, remove it.

---

ipc/sem.c +0 -1
index 87c2b64..8439f2f 100644
@@ -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;
#1 lore raw
Quoted 10 lines · On Tue, 1 Dec 2009 01:57:09 -0500 Amerigo Wang <[email protected]> wrote:

This line is unreachable, remove it.

---

ipc/sem.c +0 -0
index 87c2b64..8439f2f 100644

ipc/sem.c static int semctl_nolock(struct ipc_namespace *ns, int semid, · line 657

Quoted 7 lines
ipc/sem.c +0 -1
@@ -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':

ipc/sem.c renamed from ipc/sem.c~ipc-remove-unreachable-code-in-semc-fix +1 -1
@@ -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!

author
#2 lore raw
Quoted 37 lines · Andrew Morton
Quoted 10 lines · On Tue, 1 Dec 2009 01:57:09 -0500 Amerigo Wang <[email protected]> wrote:

This line is unreachable, remove it.

---

ipc/sem.c +0 -0
index 87c2b64..8439f2f 100644

ipc/sem.c static int semctl_nolock(struct ipc_namespace *ns, int semid, · line 657

Quoted 7 lines
ipc/sem.c +0 -1
@@ -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':

ipc/sem.c renamed from ipc/sem.c~ipc-remove-unreachable-code-in-semc-fix +1 -1
@@ -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) {

_

Quoted 1 line

you should have noticed this!

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