[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220826103843.83582-1-jinpu.wang@ionos.com>
Date: Fri, 26 Aug 2022 12:38:43 +0200
From: Jack Wang <jinpu.wang@...os.com>
To: alexander.shishkin@...ux.intel.com
Cc: christophe.jaillet@...adoo.fr, linux-kernel@...r.kernel.org
Subject: [PATCHv2] intel_th: Fix dma_map_sg error check
dma_map_sg return 0 on error, return -EIO in case of error.
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: christophe.jaillet@...adoo.fr
Cc: linux-kernel@...r.kernel.org
Fixes: 4e0eaf239fb3 ("intel_th: msu: Fix single mode with IOMMU")
Signed-off-by: Jack Wang <jinpu.wang@...os.com>
---
drivers/hwtracing/intel_th/msu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index 6c8215a47a60..472e1a4bafc1 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -931,8 +931,10 @@ static int msc_buffer_contig_alloc(struct msc *msc, unsigned long size)
ret = dma_map_sg(msc_dev(msc)->parent->parent, msc->single_sgt.sgl, 1,
DMA_FROM_DEVICE);
- if (ret < 0)
+ if (!ret) {
+ ret = -EIO;
goto err_free_pages;
+ }
msc->nr_pages = nr_pages;
msc->base = page_address(page);
--
2.34.1
Powered by blists - more mailing lists