[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240701034102.84207-1-make24@iscas.ac.cn>
Date: Mon, 1 Jul 2024 11:41:02 +0800
From: Haoxiang Li <make24@...as.ac.cn>
To: kashyap.desai@...adcom.com,
sumit.saxena@...adcom.com,
shivasharan.srikanteshwara@...adcom.com,
chandrakanth.patil@...adcom.com,
James.Bottomley@...senPartnership.com,
martin.petersen@...cle.com,
usuraj35@...il.com
Cc: megaraidlinux.pdl@...adcom.com,
linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Haoxiang Li <make24@...as.ac.cn>
Subject: [PATCH] drivers: scsi: megaraid: Add missing check for dma_set_mask
pdev->dev cannot perform DMA properly if dma_set_mask() returns non-zero.
Add check for dma_set_mask() and return the error if it fails.
Fixes: ec090ef8cd1c ("scsi: megaraid: Remove pci-dma-compat wrapper API")
Signed-off-by: Haoxiang Li <make24@...as.ac.cn>
---
drivers/scsi/megaraid.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 38976f94453e..5ddcba488c89 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -4406,10 +4406,12 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
/* Set the Mode of addressing to 64 bit if we can */
if ((adapter->flag & BOARD_64BIT) && (sizeof(dma_addr_t) == 8)) {
- dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
+ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)))
+ goto out_free_mbox;
adapter->has_64bit_addr = 1;
} else {
- dma_set_mask(&pdev->dev, DMA_BIT_MASK(32));
+ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)))
+ goto out_free_mbox;
adapter->has_64bit_addr = 0;
}
--
2.25.1
Powered by blists - more mailing lists