linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/rockchip: fix dma_alloc_attrs() error check
@ 2015-01-07  9:27 Daniel Kurtz
  2015-01-09  4:01 ` Daniel Kurtz
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kurtz @ 2015-01-07  9:27 UTC (permalink / raw)
  To: Mark Yao
  Cc: Pawel Osciak, linux-rockchip, Daniel Kurtz, David Airlie,
	Daniel Vetter, Rob Clark, open list:DRM DRIVERS, open list

dma_alloc_attrs() returns NULL if it cannot allocate a dma buffer (or
mapping), not a negative error code.

Rerported-by: Pawel Osciak <posciak@chromium.org>
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
index bc98a22..7ca8799e 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
@@ -34,12 +34,9 @@ static int rockchip_gem_alloc_buf(struct rockchip_gem_object *rk_obj)
 	rk_obj->kvaddr = dma_alloc_attrs(drm->dev, obj->size,
 					 &rk_obj->dma_addr, GFP_KERNEL,
 					 &rk_obj->dma_attrs);
-	if (IS_ERR(rk_obj->kvaddr)) {
-		int ret = PTR_ERR(rk_obj->kvaddr);
-
-		DRM_ERROR("failed to allocate %#x byte dma buffer, %d",
-			  obj->size, ret);
-		return ret;
+	if (!rk_obj->kvaddr) {
+		DRM_ERROR("failed to allocate %#x byte dma buffer", obj->size);
+		return -ENOMEM;
 	}
 
 	return 0;
-- 
2.2.0.rc0.207.ga3a616c


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

* Re: [PATCH] drm/rockchip: fix dma_alloc_attrs() error check
  2015-01-07  9:27 [PATCH] drm/rockchip: fix dma_alloc_attrs() error check Daniel Kurtz
@ 2015-01-09  4:01 ` Daniel Kurtz
  2015-01-21  2:43   ` Daniel Kurtz
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kurtz @ 2015-01-09  4:01 UTC (permalink / raw)
  To: Mark Yao
  Cc: Pawel Osciak, open list:ARM/Rockchip SoC..., Daniel Kurtz,
	David Airlie, Daniel Vetter, Rob Clark, open list:DRM DRIVERS,
	open list

On Wed, Jan 7, 2015 at 5:27 PM, Daniel Kurtz <djkurtz@chromium.org> wrote:
> dma_alloc_attrs() returns NULL if it cannot allocate a dma buffer (or
> mapping), not a negative error code.
>
> Rerported-by: Pawel Osciak <posciak@chromium.org>

Oops!  I just noticed that this is spelled wrong.  Should be "Reported-by".

Mark, could you fix up on your tree, or is it too late?

> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> index bc98a22..7ca8799e 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> @@ -34,12 +34,9 @@ static int rockchip_gem_alloc_buf(struct rockchip_gem_object *rk_obj)
>         rk_obj->kvaddr = dma_alloc_attrs(drm->dev, obj->size,
>                                          &rk_obj->dma_addr, GFP_KERNEL,
>                                          &rk_obj->dma_attrs);
> -       if (IS_ERR(rk_obj->kvaddr)) {
> -               int ret = PTR_ERR(rk_obj->kvaddr);
> -
> -               DRM_ERROR("failed to allocate %#x byte dma buffer, %d",
> -                         obj->size, ret);
> -               return ret;
> +       if (!rk_obj->kvaddr) {
> +               DRM_ERROR("failed to allocate %#x byte dma buffer", obj->size);
> +               return -ENOMEM;
>         }
>
>         return 0;
> --
> 2.2.0.rc0.207.ga3a616c
>

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

* Re: [PATCH] drm/rockchip: fix dma_alloc_attrs() error check
  2015-01-09  4:01 ` Daniel Kurtz
@ 2015-01-21  2:43   ` Daniel Kurtz
  2015-01-21  2:48     ` Dave Airlie
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kurtz @ 2015-01-21  2:43 UTC (permalink / raw)
  To: Mark Yao, David Airlie
  Cc: Pawel Osciak, open list:ARM/Rockchip SoC..., Daniel Kurtz,
	Daniel Vetter, Rob Clark, open list:DRM DRIVERS, open list

Mark: did you get a chance to fixup the "Reported-by" line?  It's not
a bit deal if you didn't.

Dave: did you pick up this pull request?  Did Mark request properly?

On Fri, Jan 9, 2015 at 12:01 PM, Daniel Kurtz <djkurtz@chromium.org> wrote:
> On Wed, Jan 7, 2015 at 5:27 PM, Daniel Kurtz <djkurtz@chromium.org> wrote:
>> dma_alloc_attrs() returns NULL if it cannot allocate a dma buffer (or
>> mapping), not a negative error code.
>>
>> Rerported-by: Pawel Osciak <posciak@chromium.org>
>
> Oops!  I just noticed that this is spelled wrong.  Should be "Reported-by".
>
> Mark, could you fix up on your tree, or is it too late?
>
>> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
>> ---
>>  drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 9 +++------
>>  1 file changed, 3 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
>> index bc98a22..7ca8799e 100644
>> --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
>> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
>> @@ -34,12 +34,9 @@ static int rockchip_gem_alloc_buf(struct rockchip_gem_object *rk_obj)
>>         rk_obj->kvaddr = dma_alloc_attrs(drm->dev, obj->size,
>>                                          &rk_obj->dma_addr, GFP_KERNEL,
>>                                          &rk_obj->dma_attrs);
>> -       if (IS_ERR(rk_obj->kvaddr)) {
>> -               int ret = PTR_ERR(rk_obj->kvaddr);
>> -
>> -               DRM_ERROR("failed to allocate %#x byte dma buffer, %d",
>> -                         obj->size, ret);
>> -               return ret;
>> +       if (!rk_obj->kvaddr) {
>> +               DRM_ERROR("failed to allocate %#x byte dma buffer", obj->size);
>> +               return -ENOMEM;
>>         }
>>
>>         return 0;
>> --
>> 2.2.0.rc0.207.ga3a616c
>>

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

* Re: [PATCH] drm/rockchip: fix dma_alloc_attrs() error check
  2015-01-21  2:43   ` Daniel Kurtz
@ 2015-01-21  2:48     ` Dave Airlie
  0 siblings, 0 replies; 4+ messages in thread
From: Dave Airlie @ 2015-01-21  2:48 UTC (permalink / raw)
  To: Daniel Kurtz
  Cc: Mark Yao, David Airlie, open list, open list:DRM DRIVERS,
	open list:ARM/Rockchip SoC..., Pawel Osciak

On 21 January 2015 at 12:43, Daniel Kurtz <djkurtz@chromium.org> wrote:
> Mark: did you get a chance to fixup the "Reported-by" line?  It's not
> a bit deal if you didn't.
>
> Dave: did you pick up this pull request?  Did Mark request properly?

I was waiting for the fixed reported-by but it isn't that urgent, I'll
get it in the next fixes round.

Dave.

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

end of thread, other threads:[~2015-01-21  2:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-07  9:27 [PATCH] drm/rockchip: fix dma_alloc_attrs() error check Daniel Kurtz
2015-01-09  4:01 ` Daniel Kurtz
2015-01-21  2:43   ` Daniel Kurtz
2015-01-21  2:48     ` Dave Airlie

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