drm/msm: fix return value check in _msm_gem_kernel_new()
authorWei Yongjun <weiyongjun1@huawei.com>
Wed, 11 Oct 2017 11:36:56 +0000 (11:36 +0000)
committerRob Clark <robdclark@gmail.com>
Thu, 12 Oct 2017 14:59:56 +0000 (10:59 -0400)
In case of error, the function msm_gem_get_vaddr() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: 8223286d62e2 ("drm/msm: Add a helper function for in-kernel
buffer allocations")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/msm_gem.c

index f15821a0d90089d1045e810e4b28af552db9eec0..0b338fbf97ce695cadf011b78634905a3bf4504a 100644 (file)
@@ -1045,10 +1045,10 @@ static void *_msm_gem_kernel_new(struct drm_device *dev, uint32_t size,
        }
 
        vaddr = msm_gem_get_vaddr(obj);
-       if (!vaddr) {
+       if (IS_ERR(vaddr)) {
                msm_gem_put_iova(obj, aspace);
                drm_gem_object_unreference(obj);
-               return ERR_PTR(-ENOMEM);
+               return ERR_CAST(vaddr);
        }
 
        if (bo)