drm/vmwgfx: Fix handling of errors returned by 'vmw_cotable_alloc()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 29 Nov 2016 06:49:19 +0000 (07:49 +0100)
committerSinclair Yeh <syeh@vmware.com>
Tue, 18 Jul 2017 06:40:55 +0000 (23:40 -0700)
'vmw_cotable_alloc()' returns an error pointer on error, not NULL.
Propagate the error code, instead of returning -ENOMEM unconditionally

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Sinclair Yeh <syeh@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_context.c

index 1a46b18bf2b7cdce2b7c5f58a4560c0ff802dec7..be08776510984c0bf8bc1798dbbe7a86f687e0f7 100644 (file)
@@ -209,8 +209,8 @@ static int vmw_gb_context_init(struct vmw_private *dev_priv,
                for (i = 0; i < SVGA_COTABLE_DX10_MAX; ++i) {
                        uctx->cotables[i] = vmw_cotable_alloc(dev_priv,
                                                              &uctx->res, i);
-                       if (unlikely(uctx->cotables[i] == NULL)) {
-                               ret = -ENOMEM;
+                       if (unlikely(IS_ERR(uctx->cotables[i]))) {
+                               ret = PTR_ERR(uctx->cotables[i]);
                                goto out_cotables;
                        }
                }