[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210518070842.273-1-zuoqilin1@163.com>
Date: Tue, 18 May 2021 15:08:42 +0800
From: zuoqilin1@....com
To: unixbhaskar@...il.com, adobriyan@...il.com, gustavoars@...nel.org,
akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org, zuoqilin <zuoqilin@...ong.com>
Subject: [PATCH] ipc: Assign value when defining variables
From: zuoqilin <zuoqilin@...ong.com>
When defining variables and assigning values can be done at the same time.
Signed-off-by: zuoqilin <zuoqilin@...ong.com>
---
ipc/sem.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/ipc/sem.c b/ipc/sem.c
index e0ec239..475d5bf 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1104,9 +1104,8 @@ static int count_semcnt(struct sem_array *sma, ushort semnum,
{
struct list_head *l;
struct sem_queue *q;
- int semcnt;
+ int semcnt = 0;
- semcnt = 0;
/* First: check the simple operations. They are easy to evaluate */
if (count_zero)
l = &sma->sems[semnum].pending_const;
@@ -1986,7 +1985,7 @@ static long do_semtimedop(int semid, struct sembuf __user *tsops,
struct sembuf fast_sops[SEMOPM_FAST];
struct sembuf *sops = fast_sops, *sop;
struct sem_undo *un;
- int max, locknum;
+ int max = 0, locknum;
bool undos = false, alter = false, dupsop = false;
struct sem_queue queue;
unsigned long dup = 0, jiffies_left = 0;
@@ -2018,7 +2017,6 @@ static long do_semtimedop(int semid, struct sembuf __user *tsops,
jiffies_left = timespec64_to_jiffies(timeout);
}
- max = 0;
for (sop = sops; sop < sops + nsops; sop++) {
unsigned long mask = 1ULL << ((sop->sem_num) % BITS_PER_LONG);
--
1.9.1
Powered by blists - more mailing lists