public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Colin King <colin.king@canonical.com>
Cc: Mike Marshall <hubcap@omnibond.com>,
	Martin Brandenburg <martin@omnibond.com>,
	devel@lists.orangefs.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] orangefs: remove redundant assignment to variable buffer_index
Date: Tue, 21 May 2019 18:01:52 +0300	[thread overview]
Message-ID: <20190521150152.GK31203@kadam> (raw)
In-Reply-To: <20190511132700.4862-1-colin.king@canonical.com>

On Sat, May 11, 2019 at 02:27:00PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The variable buffer_index is being initialized however this is never
> read and later it is being reassigned to a new value. The initialization
> is redundant and hence can be removed.
> 
> Addresses-Coverity: ("Unused Value")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  fs/orangefs/file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
> index a35c17017210..80f06ee794c5 100644
> --- a/fs/orangefs/file.c
> +++ b/fs/orangefs/file.c
> @@ -52,7 +52,7 @@ ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inode,
>  	struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
>  	struct orangefs_khandle *handle = &orangefs_inode->refn.khandle;
>  	struct orangefs_kernel_op_s *new_op = NULL;
> -	int buffer_index = -1;
> +	int buffer_index;
>  	ssize_t ret;
>  	size_t copy_amount;
>  

There is a second pointless assignment at the end of the function as
well:

   247  
   248          ret = new_op->downcall.resp.io.amt_complete;
   249  
   250  out:
   251          if (buffer_index >= 0) {
   252                  if ((readahead_size) && (type == ORANGEFS_IO_READ)) {
   253                          /* readpage */
   254                          *index_return = buffer_index;
   255                          gossip_debug(GOSSIP_FILE_DEBUG,
   256                                  "%s: hold on to buffer_index :%d:\n",
   257                                  __func__, buffer_index);
   258                  } else {
   259                          /* O_DIRECT */
   260                          orangefs_bufmap_put(buffer_index);
   261                          gossip_debug(GOSSIP_FILE_DEBUG,
   262                                  "%s(%pU): PUT buffer_index %d\n",
   263                                  __func__, handle, buffer_index);
   264                  }
   265                  buffer_index = -1;
                        ^^^^^^^^^^^^^^^^^

   266          }
   267          op_release(new_op);
   268          return ret;
   269  }

You often send these patches before they hit linux-next so I had skipped
reviewing this one when you sent it.  I'm coming back to work today
after the flu so I was going through my inbox reviewing old unread
messages...

regards,
dan carpenter

  parent reply	other threads:[~2019-05-21 15:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-11 13:27 [PATCH] orangefs: remove redundant assignment to variable buffer_index Colin King
2019-05-16 16:06 ` Mike Marshall
2019-05-21 15:03   ` Dan Carpenter
2019-06-25 18:55     ` Mike Marshall
2019-06-26  6:18       ` Dan Carpenter
2019-06-26 14:56         ` Colin Ian King
2019-05-21 15:01 ` Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-17 21:49 Colin Ian King

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=20190521150152.GK31203@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=colin.king@canonical.com \
    --cc=devel@lists.orangefs.org \
    --cc=hubcap@omnibond.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@omnibond.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