misc: fastrpc: fix incorrect usage of dma_map_sgtable
PATCH 1/1 misc: fastrpc: fix incorrect usage of dma_map_sgtable
dma_map_sgtable() returns 0 on success, which is the opposite of what this code was doing.
--- drivers/misc/fastrpc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/misc/fastrpc.c +4 -3
@@ -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; }
Signature · 1 line
2.26.1
Hi
Quoted 5 lines · Jonathan Marek
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")Signed-off-by Jonathan Marek <[email protected]>
Right, I'm really sorry for this regression.
Quoted 15 lines
--- drivers/misc/fastrpc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/misc/fastrpc.c +1
-0@@ -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;
drivers/misc/fastrpc.c fastrpc_map_dma_buf(struct dma_buf_attachment *attachment, · line 532
Quoted 10 lines
drivers/misc/fastrpc.c +3
-3-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; }
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Quoted 6 lines · Jonathan Marek
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")Signed-off-by Jonathan Marek <[email protected]>---
Quoted 25 lines
drivers/misc/fastrpc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/misc/fastrpc.c +4
-3@@ -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; }
This patch was applied to qcom/linux.git (refs/heads/for-next):
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
Quoted 8 lines · On Mon, 8 Feb 2021 15:04:01 -0500 you wrote:
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")Signed-off-by Jonathan Marek <[email protected]>--- drivers/misc/fastrpc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
Here is the summary with links:
- misc: fastrpc: fix incorrect usage of dma_map_sgtable
https://git.kernel.org/qcom/c/b212658aebda
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html