linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] misc: fastrpc: fix incorrect usage of dma_map_sgtable
@ 2021-02-08 20:04 ` Jonathan Marek
  2021-02-09  8:57   ` Marek Szyprowski
  2021-02-10 16:36   ` Srinivas Kandagatla
  0 siblings, 2 replies; 3+ messages in thread
From: Jonathan Marek @ 2021-02-08 20:04 UTC (permalink / raw)
  To: linux-arm-msm
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Marek Szyprowski, open list

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(-)

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;
 }
 
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] misc: fastrpc: fix incorrect usage of dma_map_sgtable
  2021-02-08 20:04 ` [PATCH] misc: fastrpc: fix incorrect usage of dma_map_sgtable Jonathan Marek
@ 2021-02-09  8:57   ` Marek Szyprowski
  2021-02-10 16:36   ` Srinivas Kandagatla
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Szyprowski @ 2021-02-09  8:57 UTC (permalink / raw)
  To: Jonathan Marek, linux-arm-msm
  Cc: Arnd Bergmann, Greg Kroah-Hartman, open list

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
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] misc: fastrpc: fix incorrect usage of dma_map_sgtable
  2021-02-08 20:04 ` [PATCH] misc: fastrpc: fix incorrect usage of dma_map_sgtable Jonathan Marek
  2021-02-09  8:57   ` Marek Szyprowski
@ 2021-02-10 16:36   ` Srinivas Kandagatla
  1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2021-02-10 16:36 UTC (permalink / raw)
  To: Jonathan Marek, linux-arm-msm
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Marek Szyprowski, open list



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;
>   }
>   
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-10 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210208200719eucas1p2e865a1368c6bc64bcc95a7ebe4af35ff@eucas1p2.samsung.com>
2021-02-08 20:04 ` [PATCH] misc: fastrpc: fix incorrect usage of dma_map_sgtable Jonathan Marek
2021-02-09  8:57   ` Marek Szyprowski
2021-02-10 16:36   ` Srinivas Kandagatla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).