linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND v2 1/5] block/badblocks: Remove redundant assignments
@ 2022-04-23 11:38 Michal Orzel
  2022-04-23 11:38 ` [PATCH RESEND v2 2/5] block/blk-map: Remove redundant assignment Michal Orzel
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Michal Orzel @ 2022-04-23 11:38 UTC (permalink / raw)
  To: Jens Axboe, Nathan Chancellor, Nick Desaulniers, Tom Rix
  Cc: Michal Orzel, linux-block, linux-kernel, llvm

Get rid of redundant assignments to a variable sectors from functions
badblocks_check and badblocks_clear. This variable, that is a function
parameter, is being assigned a value that is never read until the end of
function.

Reported by clang-tidy [deadcode.DeadStores]

Signed-off-by: Michal Orzel <michalorzel.eng@gmail.com>
---
 block/badblocks.c | 2 --
 1 file changed, 2 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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND v2 2/5] block/blk-map: Remove redundant assignment
  2022-04-23 11:38 [PATCH RESEND v2 1/5] block/badblocks: Remove redundant assignments Michal Orzel
@ 2022-04-23 11:38 ` Michal Orzel
  2022-04-23 11:38 ` [PATCH RESEND v2 3/5] block/partitions/acorn: Remove redundant assignments Michal Orzel
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Orzel @ 2022-04-23 11:38 UTC (permalink / raw)
  To: Jens Axboe, Nathan Chancellor, Nick Desaulniers, Tom Rix
  Cc: Michal Orzel, linux-block, linux-kernel, llvm

Get rid of redundant assignment to a variable ret from function
bio_map_user_iov as it is being assigned a value that is never read.
It is being re-assigned in the first instruction after the while loop

Reported by clang-tidy [deadcode.DeadStores]

Signed-off-by: Michal Orzel <michalorzel.eng@gmail.com>
---
 block/blk-map.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND v2 3/5] block/partitions/acorn: Remove redundant assignments
  2022-04-23 11:38 [PATCH RESEND v2 1/5] block/badblocks: Remove redundant assignments Michal Orzel
  2022-04-23 11:38 ` [PATCH RESEND v2 2/5] block/blk-map: Remove redundant assignment Michal Orzel
@ 2022-04-23 11:38 ` Michal Orzel
  2022-04-23 11:38 ` [PATCH RESEND v2 4/5] block/partitions/atari: Remove redundant assignment Michal Orzel
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Orzel @ 2022-04-23 11:38 UTC (permalink / raw)
  To: Jens Axboe, Nathan Chancellor, Nick Desaulniers, Tom Rix
  Cc: Michal Orzel, linux-block, linux-kernel, llvm

Get rid of redundant assignments to a variable slot from function
adfspart_check_ADFS. It is being assigned a value that is never read
as we are breaking out from the switch case and the function ends.

Reported by clang-tidy [deadcode.DeadStores]

Signed-off-by: Michal Orzel <michalorzel.eng@gmail.com>
---
 block/partitions/acorn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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;
 		}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND v2 4/5] block/partitions/atari: Remove redundant assignment
  2022-04-23 11:38 [PATCH RESEND v2 1/5] block/badblocks: Remove redundant assignments Michal Orzel
  2022-04-23 11:38 ` [PATCH RESEND v2 2/5] block/blk-map: Remove redundant assignment Michal Orzel
  2022-04-23 11:38 ` [PATCH RESEND v2 3/5] block/partitions/acorn: Remove redundant assignments Michal Orzel
@ 2022-04-23 11:38 ` Michal Orzel
  2022-04-23 11:38 ` [PATCH RESEND v2 5/5] block/partitions/ldm: Remove redundant assignments Michal Orzel
  2022-04-23 13:15 ` [PATCH RESEND v2 1/5] block/badblocks: " Jens Axboe
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Orzel @ 2022-04-23 11:38 UTC (permalink / raw)
  To: Jens Axboe, Nathan Chancellor, Nick Desaulniers, Tom Rix
  Cc: Michal Orzel, linux-block, linux-kernel, llvm

Get rid of redundant assignment to a variable part_fmt from function
atari_partition. It is being assigned a value that is never read until
the end of function.

Reported by clang-tidy [deadcode.DeadStores]

Signed-off-by: Michal Orzel <michalorzel.eng@gmail.com>
---
 block/partitions/atari.c | 1 -
 1 file changed, 1 deletion(-)

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));
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH RESEND v2 5/5] block/partitions/ldm: Remove redundant assignments
  2022-04-23 11:38 [PATCH RESEND v2 1/5] block/badblocks: Remove redundant assignments Michal Orzel
                   ` (2 preceding siblings ...)
  2022-04-23 11:38 ` [PATCH RESEND v2 4/5] block/partitions/atari: Remove redundant assignment Michal Orzel
@ 2022-04-23 11:38 ` Michal Orzel
  2022-04-23 13:15 ` [PATCH RESEND v2 1/5] block/badblocks: " Jens Axboe
  4 siblings, 0 replies; 6+ messages in thread
From: Michal Orzel @ 2022-04-23 11:38 UTC (permalink / raw)
  To: Richard Russon (FlatCap),
	Jens Axboe, Nathan Chancellor, Nick Desaulniers, Tom Rix
  Cc: Michal Orzel, linux-ntfs-dev, linux-block, linux-kernel, llvm

Get rid of the following redundant assignments:
- to a variable r_cols from function ldm_parse_cmp3
- to variables r_id1 and r_id2 from functions ldm_parse_dgr3 and ldm_parse_dgr4
- to a variable r_index from function ldm_parse_prt3
that end up in values not being read until the end of function.

Reported by clang-tidy [deadcode.DeadStores]

Signed-off-by: Michal Orzel <michalorzel.eng@gmail.com>
---
 block/partitions/ldm.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH RESEND v2 1/5] block/badblocks: Remove redundant assignments
  2022-04-23 11:38 [PATCH RESEND v2 1/5] block/badblocks: Remove redundant assignments Michal Orzel
                   ` (3 preceding siblings ...)
  2022-04-23 11:38 ` [PATCH RESEND v2 5/5] block/partitions/ldm: Remove redundant assignments Michal Orzel
@ 2022-04-23 13:15 ` Jens Axboe
  4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2022-04-23 13:15 UTC (permalink / raw)
  To: ndesaulniers, michalorzel.eng, trix, nathan
  Cc: linux-block, linux-kernel, llvm

On Sat, 23 Apr 2022 13:38:07 +0200, Michal Orzel wrote:
> Get rid of redundant assignments to a variable sectors from functions
> badblocks_check and badblocks_clear. This variable, that is a function
> parameter, is being assigned a value that is never read until the end of
> function.
> 
> Reported by clang-tidy [deadcode.DeadStores]
> 
> [...]

Applied, thanks!

[1/5] block/badblocks: Remove redundant assignments
      commit: 3de2e5f28cb133f1d9c1b2403079722d0e7b671e
[2/5] block/blk-map: Remove redundant assignment
      commit: 7ab89db979017255c2163880de5c63d8c9726aef
[3/5] block/partitions/acorn: Remove redundant assignments
      commit: 834726828b47c08e84df02f975e30c5c65bf316b
[4/5] block/partitions/atari: Remove redundant assignment
      commit: 87420fa94f6cdd2ae8aa3e1d8602bfa549794fac
[5/5] block/partitions/ldm: Remove redundant assignments
      commit: e233fe1aa02815f38588a5a965a197bbcabfb125

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-04-23 13:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-23 11:38 [PATCH RESEND v2 1/5] block/badblocks: Remove redundant assignments Michal Orzel
2022-04-23 11:38 ` [PATCH RESEND v2 2/5] block/blk-map: Remove redundant assignment Michal Orzel
2022-04-23 11:38 ` [PATCH RESEND v2 3/5] block/partitions/acorn: Remove redundant assignments Michal Orzel
2022-04-23 11:38 ` [PATCH RESEND v2 4/5] block/partitions/atari: Remove redundant assignment Michal Orzel
2022-04-23 11:38 ` [PATCH RESEND v2 5/5] block/partitions/ldm: Remove redundant assignments Michal Orzel
2022-04-23 13:15 ` [PATCH RESEND v2 1/5] block/badblocks: " Jens Axboe

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).