public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ipc: Convert handmade 'max' to max().
@ 2007-12-17  2:35 Richard Knutsson
  2007-12-17  2:36 ` [PATCH 2/3] msg.h: Convert m_ts from int to size_t Richard Knutsson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Richard Knutsson @ 2007-12-17  2:35 UTC (permalink / raw)
  To: kernel-janitors; +Cc: linux-kernel, Richard Knutsson

Convert handmade 'max' to max().

Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
---

 msg.c |    2 +-
 sem.c |    2 +-
 shm.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/ipc/msg.c b/ipc/msg.c
index fdf3db5..74d0709 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -473,7 +473,7 @@ asmlinkage long sys_msgctl(int msqid, int cmd, struct msqid_ds __user *buf)
 		up_read(&msg_ids(ns).rw_mutex);
 		if (copy_to_user(buf, &msginfo, sizeof(struct msginfo)))
 			return -EFAULT;
-		return (max_id < 0) ? 0 : max_id;
+		return max(max_id, 0);
 	}
 	case MSG_STAT:	/* msqid is an index rather than a msg queue id */
 	case IPC_STAT:
diff --git a/ipc/sem.c b/ipc/sem.c
index 35952c0..9ac00ac 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -641,7 +641,7 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, int semnum,
 		up_read(&sem_ids(ns).rw_mutex);
 		if (copy_to_user (arg.__buf, &seminfo, sizeof(struct seminfo))) 
 			return -EFAULT;
-		return (max_id < 0) ? 0: max_id;
+		return max(max_id, 0);
 	}
 	case SEM_STAT:
 	{
diff --git a/ipc/shm.c b/ipc/shm.c
index 3818fae..45e154a 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -704,7 +704,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
 			goto out;
 		}
 
-		err = err < 0 ? 0 : err;
+		err = max(err, 0);
 		goto out;
 	}
 	case SHM_STAT:

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

end of thread, other threads:[~2008-01-04  6:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-17  2:35 [PATCH 1/3] ipc: Convert handmade 'max' to max() Richard Knutsson
2007-12-17  2:36 ` [PATCH 2/3] msg.h: Convert m_ts from int to size_t Richard Knutsson
2007-12-22 10:31   ` Andrew Morton
2007-12-17  2:36 ` [PATCH 3/3] ipc: Convert handmade 'min' to min() Richard Knutsson
2007-12-22 10:27 ` [PATCH 1/3] ipc: Convert handmade 'max' to max() Andrew Morton
2008-01-04  6:46   ` Richard Knutsson

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