Skip to content

Commit c8659bb

Browse files
Li Zetaoaxboe
authored andcommitted
ublk: Fix signedness bug returning warning
There are two warnings reported by smatch: drivers/block/ublk_drv.c:445 ublk_setup_iod_zoned() warn: signedness bug returning '(-95)' drivers/block/ublk_drv.c:963 ublk_setup_iod() warn: signedness bug returning '(-5)' The type of "blk_status_t" is either be a u32 or u8, but this two functions return a negative value when not supported or failed. Use the error code of the blk module to fix these warnings. Fixes: 29802d7 ("ublk: enable zoned storage support") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/r/202308100201.TCRhgdvN-lkp@intel.com/ Signed-off-by: Li Zetao <lizetao1@huawei.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20230810084836.3535322-1-lizetao1@huawei.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 0ece1d6 commit c8659bb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/block/ublk_drv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ static int ublk_revalidate_disk_zones(struct ublk_device *ub)
442442
static blk_status_t ublk_setup_iod_zoned(struct ublk_queue *ubq,
443443
struct request *req)
444444
{
445-
return -EOPNOTSUPP;
445+
return BLK_STS_NOTSUPP;
446446
}
447447

448448
#endif
@@ -960,7 +960,7 @@ static blk_status_t ublk_setup_iod(struct ublk_queue *ubq, struct request *req)
960960

961961
if (!ublk_queue_is_zoned(ubq) &&
962962
(op_is_zone_mgmt(op) || op == REQ_OP_ZONE_APPEND))
963-
return -EIO;
963+
return BLK_STS_IOERR;
964964

965965
switch (req_op(req)) {
966966
case REQ_OP_READ:

0 commit comments

Comments
 (0)