linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: vasily.averin@linux.dev
To: Gautam Menghani <gautammenghani201@gmail.com>,
	akpm@linux-foundation.org,  shakeelb@google.com, mhocko@suse.com,
	manfred@colorfullife.com
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipc: Remove dead code in perform_atomic_semop()
Date: Wed, 25 May 2022 02:12:44 +0300	[thread overview]
Message-ID: <a9cd5385-5a26-c410-2609-4575cc0d6adf@linux.dev> (raw)
In-Reply-To: <20220524182244.42987-1-gautammenghani201@gmail.com>

On 5/24/22 21:22, Gautam Menghani wrote:
> Remove the line which is dead code. Fixes the clang scan warning:
> warning: Value stored to 'result' is never read [deadcode.DeadStores]
>                 result = curr->semval;
> 
> Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
> ---
>  ipc/sem.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/ipc/sem.c b/ipc/sem.c
> index 0dbdb98fdf2d..156824bcda47 100644
> --- a/ipc/sem.c
> +++ b/ipc/sem.c
> @@ -766,7 +766,6 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
>  	for (sop = sops; sop < sops + nsops; sop++) {
>  		curr = &sma->sems[sop->sem_num];
>  		sem_op = sop->sem_op;
> -		result = curr->semval;
>  
>  		if (sop->sem_flg & SEM_UNDO) {
>  			int undo = un->semadj[sop->sem_num] - sem_op;

Perhaps it would be better to keep the "result" but use it in the
marked line below, like it was done in previous part of this function?

                        un->semadj[sop->sem_num] = undo;
                }
                curr->semval += sem_op; <<<<<< VvS: here ?
                ipc_update_pid(&curr->sempid, q->pid);

Thank you,
	Vasily Averin
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2022-05-24 23:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-24 18:22 [PATCH] ipc: Remove dead code in perform_atomic_semop() Gautam Menghani
2022-05-24 23:12 ` vasily.averin [this message]
2022-05-25  4:20   ` Vasily Averin
2022-05-25 19:26 ` Manfred Spraul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9cd5385-5a26-c410-2609-4575cc0d6adf@linux.dev \
    --to=vasily.averin@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=gautammenghani201@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=mhocko@suse.com \
    --cc=shakeelb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).