summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Marek <jonathan@marek.ca>2021-02-08 15:04:01 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-04 11:38:14 +0100
commitdc798d57ca782c8255643c7ca32a8f003a0ae9b6 (patch)
treefa49677cf58fd0fa57ba14f9463e8a386643c618
parent787d7067c36b5d0be812a220b0c9db76a8c669e1 (diff)
downloadlinux-stable-dc798d57ca782c8255643c7ca32a8f003a0ae9b6.tar.gz
linux-stable-dc798d57ca782c8255643c7ca32a8f003a0ae9b6.tar.bz2
linux-stable-dc798d57ca782c8255643c7ca32a8f003a0ae9b6.zip
misc: fastrpc: fix incorrect usage of dma_map_sgtable
[ Upstream commit b212658aebda82f92967bcbd4c7380d607c3d803 ] dma_map_sgtable() returns 0 on success, which is the opposite of what this code was doing. Fixes: 7cd7edb89437 ("misc: fastrpc: fix common struct sg_table related issues") Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Jonathan Marek <jonathan@marek.ca> Link: https://lore.kernel.org/r/20210208200401.31100-1-jonathan@marek.ca Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/misc/fastrpc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 994ab67bc2dc..815d01f785df 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -520,12 +520,13 @@ fastrpc_map_dma_buf(struct dma_buf_attachment *attachment,
{
struct fastrpc_dma_buf_attachment *a = attachment->priv;
struct sg_table *table;
+ int ret;
table = &a->sgt;
- if (!dma_map_sgtable(attachment->dev, table, dir, 0))
- return ERR_PTR(-ENOMEM);
-
+ ret = dma_map_sgtable(attachment->dev, table, dir, 0);
+ if (ret)
+ table = ERR_PTR(ret);
return table;
}