Skip to contentSkip to conversation

ublk: return unsigned from ublk_{,un}map_io()

PATCH Applied Caleb Sander Mateos 3 participants 3 messages Nov 8, 2025 – Nov 11, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ublk: return unsigned from ublk_{,un}map_io()

ublk_map_io() and ublk_unmap_io() never return negative values, and their return values are stored in variables of type unsigned. Clarify that they can't fail by making their return types unsigned.

---
 drivers/block/ublk_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/block/ublk_drv.c +4 -3
index 5cf288809226..5777586e4be3 100644
@@ -961,12 +961,13 @@ static inline bool ublk_need_unmap_req(const struct request *req)
 {
 	return ublk_rq_has_data(req) &&
 	       (req_op(req) == REQ_OP_READ || req_op(req) == REQ_OP_DRV_IN);
 }
 
-static int ublk_map_io(const struct ublk_queue *ubq, const struct request *req,
-		       const struct ublk_io *io)
+static unsigned int ublk_map_io(const struct ublk_queue *ubq,
+				const struct request *req,
+				const struct ublk_io *io)
 {
 	const unsigned int rq_bytes = blk_rq_bytes(req);
 
 	if (!ublk_need_map_io(ubq))
 		return rq_bytes;
@@ -984,11 +985,11 @@ static int ublk_map_io(const struct ublk_queue *ubq, const struct request *req,
 		return ublk_copy_user_pages(req, 0, &iter, dir);
 	}
 	return rq_bytes;
 }
 
-static int ublk_unmap_io(bool need_map,
+static unsigned int ublk_unmap_io(bool need_map,
 		const struct request *req,
 		const struct ublk_io *io)
 {
 	const unsigned int rq_bytes = blk_rq_bytes(req);
 
Signature · 1 line
2.45.2
maintainer Applied
#2 lore raw
In reply to Caleb Sander Mateos
Quoted 5 lines · Caleb Sander Mateos

ublk_map_io() and ublk_unmap_io() never return negative values, and their return values are stored in variables of type unsigned. Clarify that they can't fail by making their return types unsigned.

Applied, thanks!

[1/1] ublk: return unsigned from ublk_{,un}map_io()

      commit: 727a44027815aea13d34c28254d386562efc3bab

Best regards,

Signature · 1 line
Jens Axboe