target: remove dead kmap checks
Subsystems (2)
cover target: remove dead kmap checks
kmap() and kmap_local_page() never return NULL, so the checks after them are dead code. Remove them.
No functional change intended; both patches are independent and can be applied on their own or as a subset.
---
base-commit: 7649ba73f9e7e1e04d0b46213e39c79ae09dd55c
PATCH 1/2 target: iblock: drop the dead kmap() NULL check
From: Shao Mingyin <[email protected]>
kmap() never returns NULL, so the check after it is dead code.
No functional change.
---
drivers/target/target_core_iblock.c +0 -2
@@ -461,8 +461,6 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd)int ret; buf =kmap (sg_page (sg)) + sg->offset; -if (!buf) -return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;/* * Fall back to block_execute_write_same() slow-path if * incoming WRITE_SAME payload does not contain zeros.
Re: [PATCH 1/2] target: iblock: drop the dead kmap() NULL check
Quoted 20 lines · On Thu, 2026-11-05 at 19:33 +0800, [email protected] wrote:
From: Shao Mingyin <[email protected]>
kmap()never returns NULL, so the check after it is dead code.No functional change.
Signed-off-by Shao Mingyin <[email protected]>---
drivers/target/target_core_iblock.c +0
-0@@ -461,8 +461,6 @@ iblock_execute_zero_out(struct block_device *bdev, struct se_cmd *cmd) int ret;
buf = kmap(sg_page(sg)) +sg->offset;drivers/target/target_core_iblock.c +0
-2-if (!buf) -return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE ;
Quoted 3 lines
/*
* Fall back toblock_execute_write_same()slow-path if
* incomingWRITE_SAMEpayload does not contain zeros.
Looks good.
PATCH 2/2 target: core: drop the dead kmap_local_page() NULL check
In reply to [email protected]From: Shao Mingyin <[email protected]>
kmap_local_page() never returns NULL; drop the wrapper and always zero the segment.
No functional change.
---
drivers/target/target_core_transport.c +2 -4
@@ -1646,10 +1646,8 @@ static int __target_submit(struct se_cmd *cmd)BUG_ON (!sgl); buf =kmap_local_page (sg_page (sgl)); -if (buf) { -memset (buf + sgl->offset,0 , sgl->length); -kunmap_local (buf); - } +memset (buf + sgl->offset,0 , sgl->length); +kunmap_local (buf); } }
Quoted 6 lines
kmap()andkmap_local_page()never return NULL, so the checks after them are dead code. Remove them.No functional change intended; both patches are independent and can be applied on their own or as a subset.
Applied to 7.5/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen
Quoted 9 lines · On Thu, 05 Nov 2026 19:33:46 +0800, [email protected] wrote:
kmap()andkmap_local_page()never return NULL, so the checks after them are dead code. Remove them.No functional change intended; both patches are independent and can be applied on their own or as a subset.
---
[...]
Applied to 7.5/scsi-queue, thanks!
[1/2] target: iblock: drop the dead kmap() NULL check
https://git.kernel.org/mkp/scsi/c/63d67440dc9f [2/2] target: core: drop the dead kmap_local_page() NULL check https://git.kernel.org/mkp/scsi/c/0fc91e802801
Signature · 1 line
Martin K. Petersen