All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rix <trix@redhat.com>
To: Michal Orzel <michalorzel.eng@gmail.com>,
	Jens Axboe <axboe@kernel.dk>,
	"Richard Russon (FlatCap)" <ldm@flatcap.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-ntfs-dev@lists.sourceforge.net, llvm@lists.linux.dev
Subject: Re: [PATCH] block: Remove redundant assignments
Date: Sat, 9 Apr 2022 05:01:41 -0700	[thread overview]
Message-ID: <a56d1184-d399-d5f8-765f-5a4f35dacd5e@redhat.com> (raw)
In-Reply-To: <20220409101933.207157-2-michalorzel.eng@gmail.com>


On 4/9/22 3:19 AM, Michal Orzel wrote:
> Get rid of redundant assignments which end up in values not being
> read either because they are overwritten or the function ends.

This log is the same as your last patch.

Instead of a general statement on deadstores, a more specific

analysis of the setting being removed would be helpful.

This will mean splitting the patch to match the analysis.

Tom

>
> Reported by clang-tidy [deadcode.DeadStores]
>
> Signed-off-by: Michal Orzel <michalorzel.eng@gmail.com>
> ---
>   block/badblocks.c        |  2 --
>   block/blk-map.c          |  5 ++---
>   block/partitions/acorn.c |  4 ++--
>   block/partitions/atari.c |  1 -
>   block/partitions/ldm.c   | 15 +++------------
>   5 files changed, 7 insertions(+), 20 deletions(-)
>
> diff --git a/block/badblocks.c b/block/badblocks.c
> index d39056630d9c..3afb550c0f7b 100644
> --- a/block/badblocks.c
> +++ b/block/badblocks.c
> @@ -65,7 +65,6 @@ int badblocks_check(struct badblocks *bb, sector_t s, int sectors,
>   		s >>= bb->shift;
>   		target += (1<<bb->shift) - 1;
>   		target >>= bb->shift;
> -		sectors = target - s;
>   	}
>   	/* 'target' is now the first block after the bad range */
>   
> @@ -345,7 +344,6 @@ int badblocks_clear(struct badblocks *bb, sector_t s, int sectors)
>   		s += (1<<bb->shift) - 1;
>   		s >>= bb->shift;
>   		target >>= bb->shift;
> -		sectors = target - s;
>   	}
>   
>   	write_seqlock_irq(&bb->lock);
> diff --git a/block/blk-map.c b/block/blk-map.c
> index c7f71d83eff1..fa72e63e18c2 100644
> --- a/block/blk-map.c
> +++ b/block/blk-map.c
> @@ -260,10 +260,9 @@ static int bio_map_user_iov(struct request *rq, struct iov_iter *iter,
>   
>   		npages = DIV_ROUND_UP(offs + bytes, PAGE_SIZE);
>   
> -		if (unlikely(offs & queue_dma_alignment(rq->q))) {
> -			ret = -EINVAL;
> +		if (unlikely(offs & queue_dma_alignment(rq->q)))
>   			j = 0;
> -		} else {
> +		else {
>   			for (j = 0; j < npages; j++) {
>   				struct page *page = pages[j];
>   				unsigned int n = PAGE_SIZE - offs;
> diff --git a/block/partitions/acorn.c b/block/partitions/acorn.c
> index 2c381c694c57..d2fc122d7426 100644
> --- a/block/partitions/acorn.c
> +++ b/block/partitions/acorn.c
> @@ -282,13 +282,13 @@ int adfspart_check_ADFS(struct parsed_partitions *state)
>   #ifdef CONFIG_ACORN_PARTITION_RISCIX
>   		case PARTITION_RISCIX_SCSI:
>   		case PARTITION_RISCIX_MFM:
> -			slot = riscix_partition(state, start_sect, slot,
> +			riscix_partition(state, start_sect, slot,
>   						nr_sects);
>   			break;
>   #endif
>   
>   		case PARTITION_LINUX:
> -			slot = linux_partition(state, start_sect, slot,
> +			linux_partition(state, start_sect, slot,
>   					       nr_sects);
>   			break;
>   		}
> diff --git a/block/partitions/atari.c b/block/partitions/atari.c
> index da5994175416..9655c728262a 100644
> --- a/block/partitions/atari.c
> +++ b/block/partitions/atari.c
> @@ -140,7 +140,6 @@ int atari_partition(struct parsed_partitions *state)
>   				/* accept only GEM,BGM,RAW,LNX,SWP partitions */
>   				if (!((pi->flg & 1) && OK_id(pi->id)))
>   					continue;
> -				part_fmt = 2;
>   				put_partition (state, slot,
>   						be32_to_cpu(pi->st),
>   						be32_to_cpu(pi->siz));
> diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c
> index 27f6c7d9c776..38e58960ae03 100644
> --- a/block/partitions/ldm.c
> +++ b/block/partitions/ldm.c
> @@ -736,7 +736,6 @@ static bool ldm_parse_cmp3 (const u8 *buffer, int buflen, struct vblk *vb)
>   		len = r_cols;
>   	} else {
>   		r_stripe = 0;
> -		r_cols   = 0;
>   		len = r_parent;
>   	}
>   	if (len < 0)
> @@ -783,11 +782,8 @@ static int ldm_parse_dgr3 (const u8 *buffer, int buflen, struct vblk *vb)
>   		r_id1 = ldm_relative (buffer, buflen, 0x24, r_diskid);
>   		r_id2 = ldm_relative (buffer, buflen, 0x24, r_id1);
>   		len = r_id2;
> -	} else {
> -		r_id1 = 0;
> -		r_id2 = 0;
> +	} else
>   		len = r_diskid;
> -	}
>   	if (len < 0)
>   		return false;
>   
> @@ -826,11 +822,8 @@ static bool ldm_parse_dgr4 (const u8 *buffer, int buflen, struct vblk *vb)
>   		r_id1 = ldm_relative (buffer, buflen, 0x44, r_name);
>   		r_id2 = ldm_relative (buffer, buflen, 0x44, r_id1);
>   		len = r_id2;
> -	} else {
> -		r_id1 = 0;
> -		r_id2 = 0;
> +	} else
>   		len = r_name;
> -	}
>   	if (len < 0)
>   		return false;
>   
> @@ -963,10 +956,8 @@ static bool ldm_parse_prt3(const u8 *buffer, int buflen, struct vblk *vb)
>   			return false;
>   		}
>   		len = r_index;
> -	} else {
> -		r_index = 0;
> +	} else
>   		len = r_diskid;
> -	}
>   	if (len < 0) {
>   		ldm_error("len %d < 0", len);
>   		return false;


  reply	other threads:[~2022-04-09 12:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-09 10:19 [PATCH] ipc/sem: Remove redundant assignments Michal Orzel
2022-04-09 10:19 ` [PATCH] block: " Michal Orzel
2022-04-09 12:01   ` Tom Rix [this message]
2022-04-09 13:20     ` Michal Orzel
2022-04-09 16:03       ` Tom Rix
2022-04-12 15:23         ` Michal Orzel
2022-04-09 11:47 ` [PATCH] ipc/sem: " Tom Rix
2022-04-11 15:47 ` Nathan Chancellor
2022-04-12 15:19   ` Michal Orzel

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=a56d1184-d399-d5f8-765f-5a4f35dacd5e@redhat.com \
    --to=trix@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=ldm@flatcap.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-ntfs-dev@lists.sourceforge.net \
    --cc=llvm@lists.linux.dev \
    --cc=michalorzel.eng@gmail.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.