Skip to content

Commit

Permalink
misc: fastrpc: fix incorrect usage of dma_map_sgtable
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jonathan Marek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
flto authored and gregkh committed Feb 9, 2021
1 parent d67cc29 commit b212658
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/misc/fastrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b212658

Please sign in to comment.