Skip to content

Commit bf72b4b

Browse files
Haoxiang Lizackr
authored andcommitted
drm/vmwgfx: Fix an error return check in vmw_compat_shader_add()
In vmw_compat_shader_add(), the return value check of vmw_shader_alloc() is not proper. Modify the check for the return pointer 'res'. Found by code review and compiled on ubuntu 20.04. Fixes: 18e4a46 ("drm/vmwgfx: Fix compat shader namespace") Cc: stable@vger.kernel.org Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn> Signed-off-by: Zack Rusin <zack.rusin@broadcom.com> Link: https://patch.msgid.link/20251224091105.1569464-1-lihaoxiang@isrc.iscas.ac.cn
1 parent 37a0cff commit bf72b4b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/gpu/drm/vmwgfx/vmwgfx_shader.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,8 +923,10 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv,
923923
ttm_bo_unreserve(&buf->tbo);
924924

925925
res = vmw_shader_alloc(dev_priv, buf, size, 0, shader_type);
926-
if (unlikely(ret != 0))
926+
if (IS_ERR(res)) {
927+
ret = PTR_ERR(res);
927928
goto no_reserve;
929+
}
928930

929931
ret = vmw_cmdbuf_res_add(man, vmw_cmdbuf_res_shader,
930932
vmw_shader_key(user_key, shader_type),

0 commit comments

Comments
 (0)