diff options
author | Daniel Kurtz <djkurtz@chromium.org> | 2015-01-07 12:27:06 +0300 |
---|---|---|
committer | Mark Yao <mark.yao@rock-chips.com> | 2015-01-09 06:29:06 +0300 |
commit | 4b9a90c0b374f8f7b3ceabe3c202424c98a6c5a4 (patch) | |
tree | 2ee8991dcfd90a81e0a78caf08bf6c21c18ee3c7 /drivers/gpu/drm/rockchip/rockchip_drm_gem.c | |
parent | c93546a5e32bd788c22aefa072385f3784551c13 (diff) | |
download | linux-4b9a90c0b374f8f7b3ceabe3c202424c98a6c5a4.tar.xz |
drm/rockchip: fix dma_alloc_attrs() error check
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>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Diffstat (limited to 'drivers/gpu/drm/rockchip/rockchip_drm_gem.c')
-rw-r--r-- | drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 9 |
1 files 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 bc98a227dc76..7ca8799ef784 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; |