summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAlok Tiwari <alok.a.tiwari@oracle.com>2025-09-07 12:40:16 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-02 13:44:05 +0200
commit8d685863f557cdf5f8328c30914a9ac5b0c53e7f (patch)
treead46bb52d7c3590af4fe5dc4d89545ed2bd79ebf /drivers
parentda274362a7bd9ab3a6e46d15945029145ebce672 (diff)
downloadlinux-8d685863f557cdf5f8328c30914a9ac5b0c53e7f.tar.gz
linux-8d685863f557cdf5f8328c30914a9ac5b0c53e7f.tar.bz2
linux-8d685863f557cdf5f8328c30914a9ac5b0c53e7f.zip
scsi: ufs: mcq: Fix memory allocation checks for SQE and CQE
[ Upstream commit 5cb782ff3c62c837e4984b6ae9f5d9a423cd5088 ] Previous checks incorrectly tested the DMA addresses (dma_handle) for NULL. Since dma_alloc_coherent() returns the CPU (virtual) address, the NULL check should be performed on the *_base_addr pointer to correctly detect allocation failures. Update the checks to validate sqe_base_addr and cqe_base_addr instead of sqe_dma_addr and cqe_dma_addr. Fixes: 4682abfae2eb ("scsi: ufs: core: mcq: Allocate memory for MCQ mode") Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Reviewed-by: Peter Wang <peter.wang@mediatek.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ufs/core/ufs-mcq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 420e943bb73a..5e6197a6af5e 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -243,7 +243,7 @@ int ufshcd_mcq_memory_alloc(struct ufs_hba *hba)
hwq->sqe_base_addr = dmam_alloc_coherent(hba->dev, utrdl_size,
&hwq->sqe_dma_addr,
GFP_KERNEL);
- if (!hwq->sqe_dma_addr) {
+ if (!hwq->sqe_base_addr) {
dev_err(hba->dev, "SQE allocation failed\n");
return -ENOMEM;
}
@@ -252,7 +252,7 @@ int ufshcd_mcq_memory_alloc(struct ufs_hba *hba)
hwq->cqe_base_addr = dmam_alloc_coherent(hba->dev, cqe_size,
&hwq->cqe_dma_addr,
GFP_KERNEL);
- if (!hwq->cqe_dma_addr) {
+ if (!hwq->cqe_base_addr) {
dev_err(hba->dev, "CQE allocation failed\n");
return -ENOMEM;
}