* [PATCH 0/2] target: remove dead kmap checks
@ 2026-11-05 11:33 shao.mingyin
2026-11-05 11:33 ` [PATCH 1/2] target: iblock: drop the dead kmap() NULL check shao.mingyin
2026-11-05 11:33 ` [PATCH 2/2] target: core: drop the dead kmap_local_page() " shao.mingyin
0 siblings, 2 replies; 4+ messages in thread
From: shao.mingyin @ 2026-11-05 11:33 UTC (permalink / raw)
To: mkp, linux-scsi, target-devel; +Cc: James.Bottomley, linux-kernel
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.
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
base-commit: 7649ba73f9e7e1e04d0b46213e39c79ae09dd55c
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] target: iblock: drop the dead kmap() NULL check
2026-11-05 11:33 [PATCH 0/2] target: remove dead kmap checks shao.mingyin
@ 2026-11-05 11:33 ` shao.mingyin
2026-11-05 18:58 ` Laurence Oberman
2026-11-05 11:33 ` [PATCH 2/2] target: core: drop the dead kmap_local_page() " shao.mingyin
1 sibling, 1 reply; 4+ messages in thread
From: shao.mingyin @ 2026-11-05 11:33 UTC (permalink / raw)
To: mkp, linux-scsi, target-devel; +Cc: James.Bottomley, linux-kernel
From: Shao Mingyin <shao.mingyin@zte.com.cn>
kmap() never returns NULL, so the check after it is dead code.
No functional change.
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index ea65d39fef88..604fca959f2e 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] target: iblock: drop the dead kmap() NULL check
2026-11-05 11:33 ` [PATCH 1/2] target: iblock: drop the dead kmap() NULL check shao.mingyin
@ 2026-11-05 18:58 ` Laurence Oberman
0 siblings, 0 replies; 4+ messages in thread
From: Laurence Oberman @ 2026-11-05 18:58 UTC (permalink / raw)
To: shao.mingyin, mkp, linux-scsi, target-devel; +Cc: James.Bottomley, linux-kernel
On Thu, 2026-11-05 at 19:33 +0800, shao.mingyin@zte.com.cn wrote:
> From: Shao Mingyin <shao.mingyin@zte.com.cn>
>
> kmap() never returns NULL, so the check after it is dead code.
>
> No functional change.
>
> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
> ---
> diff --git a/drivers/target/target_core_iblock.c
> b/drivers/target/target_core_iblock.c
> index ea65d39fef88..604fca959f2e 100644
> --- a/drivers/target/target_core_iblock.c
> +++ b/drivers/target/target_core_iblock.c
> @@ -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.
Looks good.
Reviewed-by: Laurence Oberman <loberman@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] target: core: drop the dead kmap_local_page() NULL check
2026-11-05 11:33 [PATCH 0/2] target: remove dead kmap checks shao.mingyin
2026-11-05 11:33 ` [PATCH 1/2] target: iblock: drop the dead kmap() NULL check shao.mingyin
@ 2026-11-05 11:33 ` shao.mingyin
1 sibling, 0 replies; 4+ messages in thread
From: shao.mingyin @ 2026-11-05 11:33 UTC (permalink / raw)
To: mkp, linux-scsi, target-devel; +Cc: James.Bottomley, linux-kernel
From: Shao Mingyin <shao.mingyin@zte.com.cn>
kmap_local_page() never returns NULL; drop the wrapper and always
zero the segment.
No functional change.
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 927861c30afc..9819515ce967 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -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);
}
}
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-05 18:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 11:33 [PATCH 0/2] target: remove dead kmap checks shao.mingyin
2026-11-05 11:33 ` [PATCH 1/2] target: iblock: drop the dead kmap() NULL check shao.mingyin
2026-11-05 18:58 ` Laurence Oberman
2026-11-05 11:33 ` [PATCH 2/2] target: core: drop the dead kmap_local_page() " 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®