Re: [PATCH] drm/rockchip: fix dma_alloc_attrs() error check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 7, 2015 at 5:27 PM, Daniel Kurtz <djkurtz@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>

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@xxxxxxxxxxxx>
> ---
>  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
>
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux