Skip to contentSkip to conversation

null_blk: Fix two sparse warnings

PATCH Applied Bart Van Assche 2 participants 2 messages May 10, 2024 – May 11, 2024 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 null_blk: Fix two sparse warnings

Fix the following sparse warnings:

drivers/block/null_blk/main.c:1243:35: warning: incorrect type in return expression (different base types)
drivers/block/null_blk/main.c:1243:35: expected int
drivers/block/null_blk/main.c:1243:35: got restricted blk_status_t
drivers/block/null_blk/main.c:1291:30: warning: incorrect type in return expression (different base types)
drivers/block/null_blk/main.c:1291:30: expected restricted blk_status_t
drivers/block/null_blk/main.c:1291:30: got int

Cc Christoph Hellwig <[email protected]>
Cc Damien Le Moal <[email protected]>
---
 drivers/block/null_blk/main.c  | 2 +-
 drivers/block/null_blk/trace.h | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/block/null_blk/main.c +1 -1
index 4005a8b685e8..5d56ad4ce01a 100644
@@ -1218,7 +1218,7 @@ static int null_transfer(struct nullb *nullb, struct page *page,
 	return err;
 }
 
-static int null_handle_rq(struct nullb_cmd *cmd)
+static blk_status_t null_handle_rq(struct nullb_cmd *cmd)
 {
 	struct request *rq = blk_mq_rq_from_pdu(cmd);
 	struct nullb *nullb = cmd->nq->dev->nullb;
drivers/block/null_blk/trace.h +6 -1
index ef2d05d5f0df..82b8f6a5e5f0 100644
@@ -36,7 +36,12 @@ TRACE_EVENT(nullb_zone_op,
 	    TP_ARGS(cmd, zone_no, zone_cond),
 	    TP_STRUCT__entry(
 		__array(char, disk, DISK_NAME_LEN)
-		__field(enum req_op, op)
+		/*
+		 * __field() uses is_signed_type(). is_signed_type() does not
+		 * support bitwise types. Use __field_struct() instead because
+		 * it does not use is_signed_type().
+		 */
+		__field_struct(enum req_op, op)
 		__field(unsigned int, zone_no)
 		__field(unsigned int, zone_cond)
 	    ),
maintainer Applied
#1 lore raw
Quoted 10 lines · Bart Van Assche

Fix the following sparse warnings:

drivers/block/null_blk/main.c:1243:35: warning: incorrect type in return expression (different base types)
drivers/block/null_blk/main.c:1243:35: expected int
drivers/block/null_blk/main.c:1243:35: got restricted blk_status_t
drivers/block/null_blk/main.c:1291:30: warning: incorrect type in return expression (different base types)
drivers/block/null_blk/main.c:1291:30: expected restricted blk_status_t
drivers/block/null_blk/main.c:1291:30: got int

[...]

Applied, thanks!

[1/1] null_blk: Fix two sparse warnings

      commit: e655d93e55b9ef7508b59d2d42a58549a37fd4aa

Best regards,

Signature · 1 line
Jens Axboe