lkml.org 
[lkml]   [2021]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ipc: Assign value when defining variables
Date
From: zuoqilin <zuoqilin@yulong.com>

When defining variables and assigning values can be done at the same time.

Signed-off-by: zuoqilin <zuoqilin@yulong.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

\
 
 \ /
  Last update: 2021-05-18 09:09    [W:0.042 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site