[PATCH] virtio_blk: use UINT_MAX instead of -1U

Angus Chen posted 1 patch 3 years, 1 month ago
drivers/block/virtio_blk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] virtio_blk: use UINT_MAX instead of -1U
Posted by Angus Chen 3 years, 1 month ago
We use UINT_MAX to limit max_discard_sectors in virtblk_probe,
we can use UINT_MAX to limit max_hw_sectors for consistencies.

No functional change intended.

Signed-off-by: Angus Chen <angus.chen@jaguarmicro.com>
---
 drivers/block/virtio_blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 19da5defd734..02d3027dd32d 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -991,7 +991,7 @@ static int virtblk_probe(struct virtio_device *vdev)
 	blk_queue_max_segments(q, sg_elems);
 
 	/* No real sector limit. */
-	blk_queue_max_hw_sectors(q, -1U);
+	blk_queue_max_hw_sectors(q, UINT_MAX);
 
 	max_size = virtio_max_dma_size(vdev);
 
-- 
2.25.1
Re: [PATCH] virtio_blk: use UINT_MAX instead of -1U
Posted by Stefan Hajnoczi 3 years, 1 month ago
On Thu, Nov 10, 2022 at 11:01:23AM +0800, Angus Chen wrote:
> We use UINT_MAX to limit max_discard_sectors in virtblk_probe,
> we can use UINT_MAX to limit max_hw_sectors for consistencies.
> 
> No functional change intended.
> 
> Signed-off-by: Angus Chen <angus.chen@jaguarmicro.com>
> ---
>  drivers/block/virtio_blk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>