If amdgpu_gem_prime_export() fails, then this code accidentally
returns zero/success instead of a negative error code.
Fixes: 5ac3c3e45fb93d ("drm/amdgpu: Add DMA mapping of GTT BOs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
                      struct amdgpu_bo **bo)
 {
        struct drm_gem_object *gobj;
+       int ret;
 
        if (!mem->dmabuf) {
                mem->dmabuf = amdgpu_gem_prime_export(&mem->bo->tbo.base,
                        mem->alloc_flags & KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE ?
                                DRM_RDWR : 0);
                if (IS_ERR(mem->dmabuf)) {
+                       ret = PTR_ERR(mem->dmabuf);
                        mem->dmabuf = NULL;
-                       return PTR_ERR(mem->dmabuf);
+                       return ret;
                }
        }