Skip to content

Commit

Permalink
block/partitions/ldm: Remove redundant assignments
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
orzelmichal authored and axboe committed Apr 23, 2022
1 parent 87420fa commit e233fe1
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions block/partitions/ldm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e233fe1

Please sign in to comment.