HSI: omap_ssi_port: Fix dma_map_sg error check

[ Upstream commit 551e325bbd3fb8b5a686ac1e6cf76e5641461cf2 ]

dma_map_sg return 0 on error, in case of error return -EIO
to caller.

Cc: Sebastian Reichel <sre@kernel.org>
Cc: linux-kernel@vger.kernel.org (open list)
Fixes: b209e047bc ("HSI: Introduce OMAP SSI driver")
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Jack Wang 2022-08-26 12:12:27 +02:00 committed by Greg Kroah-Hartman
parent e8a218c17d
commit 1c837ba2da

View File

@ -253,10 +253,10 @@ static int ssi_start_dma(struct hsi_msg *msg, int lch)
if (msg->ttype == HSI_MSG_READ) { if (msg->ttype == HSI_MSG_READ) {
err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents,
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
if (err < 0) { if (!err) {
dev_dbg(&ssi->device, "DMA map SG failed !\n"); dev_dbg(&ssi->device, "DMA map SG failed !\n");
pm_runtime_put_autosuspend(omap_port->pdev); pm_runtime_put_autosuspend(omap_port->pdev);
return err; return -EIO;
} }
csdp = SSI_DST_BURST_4x32_BIT | SSI_DST_MEMORY_PORT | csdp = SSI_DST_BURST_4x32_BIT | SSI_DST_MEMORY_PORT |
SSI_SRC_SINGLE_ACCESS0 | SSI_SRC_PERIPHERAL_PORT | SSI_SRC_SINGLE_ACCESS0 | SSI_SRC_PERIPHERAL_PORT |
@ -270,10 +270,10 @@ static int ssi_start_dma(struct hsi_msg *msg, int lch)
} else { } else {
err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents, err = dma_map_sg(&ssi->device, msg->sgt.sgl, msg->sgt.nents,
DMA_TO_DEVICE); DMA_TO_DEVICE);
if (err < 0) { if (!err) {
dev_dbg(&ssi->device, "DMA map SG failed !\n"); dev_dbg(&ssi->device, "DMA map SG failed !\n");
pm_runtime_put_autosuspend(omap_port->pdev); pm_runtime_put_autosuspend(omap_port->pdev);
return err; return -EIO;
} }
csdp = SSI_SRC_BURST_4x32_BIT | SSI_SRC_MEMORY_PORT | csdp = SSI_SRC_BURST_4x32_BIT | SSI_SRC_MEMORY_PORT |
SSI_DST_SINGLE_ACCESS0 | SSI_DST_PERIPHERAL_PORT | SSI_DST_SINGLE_ACCESS0 | SSI_DST_PERIPHERAL_PORT |