Message ID | 20210208200401.31100-1-jonathan@marek.ca (mailing list archive) |
---|---|
State | Accepted |
Commit | b212658aebda82f92967bcbd4c7380d607c3d803 |
Headers | show |
Series | misc: fastrpc: fix incorrect usage of dma_map_sgtable | expand |
Hi On 08.02.2021 21:04, Jonathan Marek 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 <jonathan@marek.ca> Right, I'm really sorry for this regression. Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- > drivers/misc/fastrpc.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c > index 70eb5ed942d0..f12e909034ac 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; > } > Best regards
On 08/02/2021 20:04, Jonathan Marek 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 <jonathan@marek.ca> > --- Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > drivers/misc/fastrpc.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c > index 70eb5ed942d0..f12e909034ac 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; > } > >
Hello: This patch was applied to qcom/linux.git (refs/heads/for-next): 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 <jonathan@marek.ca> > --- > 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
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 70eb5ed942d0..f12e909034ac 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; }
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 <jonathan@marek.ca> --- drivers/misc/fastrpc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)