mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] scsi: remove dead code and redundant checks
@ 2026-11-05 11:33 shao.mingyin
  2026-11-05 11:33 ` [PATCH 1/5] scsi: ufs: drop the unreachable offset check shao.mingyin
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: shao.mingyin @ 2026-11-05 11:33 UTC (permalink / raw)
  To: mkp, linux-scsi
  Cc: James.Bottomley, alim.akhtar, bvanassche, beanhuo, stanleyjhu,
	loberman, jmeneghi, linux-kernel

This series removes checks that the surrounding code already guarantees and
one store that is overwritten a few lines later.  It was found while reading
the SCSI midlayer and the UFS, sd and st drivers.  There is no functional
change intended; every patch is independent and can be applied on its own or
as any subset.

Patch 1 removes a repeated offset check in ufshcd_read_desc_param().  The
function already rejects param_offset >= buff_len before it reaches the
is_kmalloc block, so the inner test can never be true.

Patch 2 drops the "result < SCSI_VPD_HEADER_SIZE" branch in
scsi_get_vpd_size().  scsi_vpd_inquiry() returns the page length plus the
four-byte header, and returns -EIO when the length is zero, so the value is
always at least 5.

Patch 3 removes the first of two identical nr_blocks stores in
sd_setup_atomic_cmnd().  The second store, after the boundary field, wins.

Patch 4 drops two -EOVERFLOW branches in sd_read_capacity().  Neither
read_capacity_10() nor read_capacity_16() returns that value any more.

Patch 5 factors the duplicated end-of-medium test in st.c into a helper.
The similar test in write_behind_check() is intentionally left alone: it has
different remainder handling and only uses EOM to turn -EIO into -ENOSPC.

Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
base-commit: 7649ba73f9e7e1e04d0b46213e39c79ae09dd55c

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

end of thread, other threads:[~2026-11-06  7:43 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 11:33 [PATCH 0/5] scsi: remove dead code and redundant checks shao.mingyin
2026-11-05 11:33 ` [PATCH 1/5] scsi: ufs: drop the unreachable offset check shao.mingyin
2026-11-05 17:18   ` Bart Van Assche
2026-11-05 11:33 ` [PATCH 2/5] scsi: core: drop the dead VPD size check shao.mingyin
2026-11-05 17:18   ` Bart Van Assche
2026-11-05 11:33 ` [PATCH 3/5] scsi: sd: drop the dead nr_blocks store shao.mingyin
2026-11-05 11:33 ` [PATCH 4/5] scsi: sd: drop the dead -EOVERFLOW branches shao.mingyin
2026-11-05 17:20   ` Bart Van Assche
2026-11-06  7:42     ` shao.mingyin
2026-11-05 11:33 ` [PATCH 5/5] scsi: st: factor out the end-of-medium completion test shao.mingyin
2026-11-05 17:21   ` Bart Van Assche
2026-11-06  7:42     ` shao.mingyin
2026-11-05 17:54 ` [PATCH 0/5] scsi: remove dead code and redundant checks Bart Van Assche
2026-11-06  7:42   ` shao.mingyin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®