Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jul 2015 19:14:30 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285057 - head/sys/kern
Message-ID:  <201507021914.t62JEUro037068@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Thu Jul  2 19:14:30 2015
New Revision: 285057
URL: https://svnweb.freebsd.org/changeset/base/285057

Log:
  sysvshm: fix up some whitespace issues and spurious initialisation

Modified:
  head/sys/kern/sysv_shm.c

Modified: head/sys/kern/sysv_shm.c
==============================================================================
--- head/sys/kern/sysv_shm.c	Thu Jul  2 19:03:44 2015	(r285056)
+++ head/sys/kern/sysv_shm.c	Thu Jul  2 19:14:30 2015	(r285057)
@@ -216,7 +216,7 @@ shm_find_segment(int arg, bool is_shmid)
 	shmseg = &shmsegs[segnum];
 	if ((shmseg->u.shm_perm.mode & SHMSEG_ALLOCATED) == 0 ||
 	    (!shm_allow_removed &&
-	     (shmseg->u.shm_perm.mode & SHMSEG_REMOVED) != 0) ||
+	    (shmseg->u.shm_perm.mode & SHMSEG_REMOVED) != 0) ||
 	    (is_shmid && shmseg->u.shm_perm.seq != IPCID_TO_SEQ(arg)))
 		return (NULL);
 	return (shmseg);
@@ -278,8 +278,9 @@ kern_shmdt_locked(struct thread *td, con
 	struct shmmap_state *shmmap_s;
 #ifdef MAC
 	struct shmid_kernel *shmsegptr;
+	int error;
 #endif
-	int error, i;
+	int i;
 
 	SYSVSHM_ASSERT_LOCKED();
 	if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC))
@@ -301,8 +302,7 @@ kern_shmdt_locked(struct thread *td, con
 	if (error != 0)
 		return (error);
 #endif
-	error = shm_delete_mapping(p->p_vmspace, shmmap_s);
-	return (error);
+	return (shm_delete_mapping(p->p_vmspace, shmmap_s));
 }
 
 #ifndef _SYS_SYSPROTO_H_
@@ -441,7 +441,6 @@ kern_shmctl_locked(struct thread *td, in
 	if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC))
 		return (ENOSYS);
 
-	error = 0;
 	switch (cmd) {
 	/*
 	 * It is possible that kern_shmctl is being called from the Linux ABI
@@ -550,10 +549,10 @@ struct shmctl_args {
 int
 sys_shmctl(struct thread *td, struct shmctl_args *uap)
 {
-	int error = 0;
+	int error;
 	struct shmid_ds buf;
 	size_t bufsz;
-	
+
 	/*
 	 * The only reason IPC_INFO, SHM_INFO, SHM_STAT exists is to support
 	 * Linux binaries.  If we see the call come through the FreeBSD ABI,
@@ -568,11 +567,11 @@ sys_shmctl(struct thread *td, struct shm
 		if ((error = copyin(uap->buf, &buf, sizeof(struct shmid_ds))))
 			goto done;
 	}
-	
+
 	error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&buf, &bufsz);
 	if (error)
 		goto done;
-	
+
 	/* Cases in which we need to copyout */
 	switch (uap->cmd) {
 	case IPC_STAT:
@@ -894,7 +893,7 @@ shminit(void)
 static int
 shmunload(void)
 {
-	int i;	
+	int i;
 
 	if (shm_nused > 0)
 		return (EBUSY);
@@ -995,8 +994,7 @@ oshmctl(struct thread *td, struct oshmct
 	outbuf.shm_ctime = shmseg->u.shm_ctime;
 	outbuf.shm_handle = shmseg->object;
 	SYSVSHM_UNLOCK();
-	error = copyout(&outbuf, uap->ubuf, sizeof(outbuf));
-	return (error);
+	return (copyout(&outbuf, uap->ubuf, sizeof(outbuf)));
 #else
 	return (EINVAL);
 #endif
@@ -1021,14 +1019,12 @@ struct shmsys_args {
 int
 sys_shmsys(struct thread *td, struct shmsys_args *uap)
 {
-	int error;
 
 	if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC))
 		return (ENOSYS);
 	if (uap->which < 0 || uap->which >= nitems(shmcalls))
 		return (EINVAL);
-	error = (*shmcalls[uap->which])(td, &uap->a2);
-	return (error);
+	return ((*shmcalls[uap->which])(td, &uap->a2));
 }
 
 #endif	/* i386 && (COMPAT_FREEBSD4 || COMPAT_43) */
@@ -1087,7 +1083,7 @@ int
 freebsd7_freebsd32_shmctl(struct thread *td,
     struct freebsd7_freebsd32_shmctl_args *uap)
 {
-	int error = 0;
+	int error;
 	union {
 		struct shmid_ds shmid_ds;
 		struct shm_info shm_info;
@@ -1114,11 +1110,11 @@ freebsd7_freebsd32_shmctl(struct thread 
 		CP(u32.shmid_ds32, u.shmid_ds, shm_dtime);
 		CP(u32.shmid_ds32, u.shmid_ds, shm_ctime);
 	}
-	
+
 	error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz);
 	if (error)
 		goto done;
-	
+
 	/* Cases in which we need to copyout */
 	switch (uap->cmd) {
 	case IPC_INFO:
@@ -1172,7 +1168,7 @@ done:
 int
 freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap)
 {
-	int error = 0;
+	int error;
 	union {
 		struct shmid_ds shmid_ds;
 		struct shm_info shm_info;
@@ -1184,7 +1180,7 @@ freebsd32_shmctl(struct thread *td, stru
 		struct shminfo32 shminfo32;
 	} u32;
 	size_t sz;
-	
+
 	if (uap->cmd == IPC_SET) {
 		if ((error = copyin(uap->buf, &u32.shmid_ds32,
 		    sizeof(u32.shmid_ds32))))
@@ -1199,11 +1195,11 @@ freebsd32_shmctl(struct thread *td, stru
 		CP(u32.shmid_ds32, u.shmid_ds, shm_dtime);
 		CP(u32.shmid_ds32, u.shmid_ds, shm_ctime);
 	}
-	
+
 	error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz);
 	if (error)
 		goto done;
-	
+
 	/* Cases in which we need to copyout */
 	switch (uap->cmd) {
 	case IPC_INFO:
@@ -1270,11 +1266,11 @@ struct freebsd7_shmctl_args {
 int
 freebsd7_shmctl(struct thread *td, struct freebsd7_shmctl_args *uap)
 {
-	int error = 0;
+	int error;
 	struct shmid_ds_old old;
 	struct shmid_ds buf;
 	size_t bufsz;
-	
+
 	/*
 	 * The only reason IPC_INFO, SHM_INFO, SHM_STAT exists is to support
 	 * Linux binaries.  If we see the call come through the FreeBSD ABI,
@@ -1297,7 +1293,7 @@ freebsd7_shmctl(struct thread *td, struc
 		CP(old, buf, shm_dtime);
 		CP(old, buf, shm_ctime);
 	}
-	
+
 	error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&buf, &bufsz);
 	if (error)
 		goto done;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507021914.t62JEUro037068>