Skip to content

Commit dc798d5

Browse files
fltogregkh
authored andcommitted
misc: fastrpc: fix incorrect usage of dma_map_sgtable
[ Upstream commit b212658 ] dma_map_sgtable() returns 0 on success, which is the opposite of what this code was doing. Fixes: 7cd7edb ("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>
1 parent 787d706 commit dc798d5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎drivers/misc/fastrpc.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,13 @@ fastrpc_map_dma_buf(struct dma_buf_attachment *attachment,
520520
{
521521
struct fastrpc_dma_buf_attachment *a = attachment->priv;
522522
struct sg_table *table;
523+
int ret;
523524

524525
table = &a->sgt;
525526

526-
if (!dma_map_sgtable(attachment->dev, table, dir, 0))
527-
return ERR_PTR(-ENOMEM);
528-
527+
ret = dma_map_sgtable(attachment->dev, table, dir, 0);
528+
if (ret)
529+
table = ERR_PTR(ret);
529530
return table;
530531
}
531532

0 commit comments

Comments
 (0)