From 5250914df76d36b5fb05edfc903970953ef4986e Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 27 Oct 2021 12:41:26 -0400 Subject: [PATCH] nvme_disk: Remove redundant check. If the address % pagesize == 0, then clearly it is also aligned on 32 bits, and we do not need to check & 0x3. --- src/add-ons/kernel/drivers/disk/nvme/nvme_disk.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/drivers/disk/nvme/nvme_disk.cpp b/src/add-ons/kernel/drivers/disk/nvme/nvme_disk.cpp index d8794a5927..538ec8a22d 100644 --- a/src/add-ons/kernel/drivers/disk/nvme/nvme_disk.cpp +++ b/src/add-ons/kernel/drivers/disk/nvme/nvme_disk.cpp @@ -294,8 +294,8 @@ nvme_disk_init_device(void* _info, void** _cookie) dma_restrictions restrictions = {}; restrictions.alignment = B_PAGE_SIZE; - // Technically, the first and last segments in a transfer can be - // unaligned, and the rest only need to have sizes that are a multiple + // Technically, the first and last segments in a transfer can be aligned + // only on 32-bits, and the rest only need to have sizes that are a multiple // of the block size. restrictions.max_segment_count = (NVME_MAX_SGL_DESCRIPTORS / 2); restrictions.max_transfer_size = cstat.max_xfer_size; @@ -701,7 +701,7 @@ nvme_disk_io(void* cookie, io_request* request) entry = &nvme_request.iovecs[nvme_request.iovec_count - 1]; if (!bounceAll && ((entry->address % B_PAGE_SIZE) != 0 - || (entry->address & 0x3) != 0 || (entry->size % block_size) != 0)) + || (entry->size % block_size) != 0)) bounceAll = true; }