misc: vmw_vmci: return the correct errno code
authorJunlin Yang <yangjunlin@yulong.com>
Sat, 19 Jun 2021 11:28:54 +0000 (19:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 24 Jun 2021 13:47:13 +0000 (15:47 +0200)
When kzalloc failed, should return -ENOMEM rather than -EINVAL.

Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
Link: https://lore.kernel.org/r/20210619112854.1720-1-angkery@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/vmw_vmci/vmci_context.c

index 26ff49f..c0b5e33 100644 (file)
@@ -107,7 +107,7 @@ struct vmci_ctx *vmci_ctx_create(u32 cid, u32 priv_flags,
        context = kzalloc(sizeof(*context), GFP_KERNEL);
        if (!context) {
                pr_warn("Failed to allocate memory for VMCI context\n");
-               error = -EINVAL;
+               error = -ENOMEM;
                goto err_out;
        }