[PATCH 08/14] scsi: mpi3mr: Used min() in mpi3mr_map_data_buffer_dma for buffer size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Prabhakar Pujeri <prabhakar.pujeri@xxxxxxxxx>
---
 drivers/scsi/mpi3mr/mpi3mr_app.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c
index cd261b48eb46..350f3df02baf 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_app.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_app.c
@@ -1171,11 +1171,8 @@ static int mpi3mr_map_data_buffer_dma(struct mpi3mr_ioc *mrioc,
 		drv_buf->dma_desc[i].addr = mrioc->ioctl_sge[desc_count].addr;
 		drv_buf->dma_desc[i].dma_addr =
 		    mrioc->ioctl_sge[desc_count].dma_addr;
-		if (buf_len < mrioc->ioctl_sge[desc_count].size)
-			drv_buf->dma_desc[i].size = buf_len;
-		else
-			drv_buf->dma_desc[i].size =
-			    mrioc->ioctl_sge[desc_count].size;
+		drv_buf->dma_desc[i].size = min(buf_len,
+						mrioc->ioctl_sge[desc_count].size);
 		buf_len -= drv_buf->dma_desc[i].size;
 		memset(drv_buf->dma_desc[i].addr, 0,
 		       mrioc->ioctl_sge[desc_count].size);
-- 
2.45.1





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux