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>
This commit is contained in:
parent
c93546a5e3
commit
4b9a90c0b3
|
@ -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->kvaddr = dma_alloc_attrs(drm->dev, obj->size,
|
||||||
&rk_obj->dma_addr, GFP_KERNEL,
|
&rk_obj->dma_addr, GFP_KERNEL,
|
||||||
&rk_obj->dma_attrs);
|
&rk_obj->dma_attrs);
|
||||||
if (IS_ERR(rk_obj->kvaddr)) {
|
if (!rk_obj->kvaddr) {
|
||||||
int ret = PTR_ERR(rk_obj->kvaddr);
|
DRM_ERROR("failed to allocate %#x byte dma buffer", obj->size);
|
||||||
|
return -ENOMEM;
|
||||||
DRM_ERROR("failed to allocate %#x byte dma buffer, %d",
|
|
||||||
obj->size, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue