[PATCH] vhost_task: Fix vhost_task_create return value

From: Mike Christie
Date: Tue Mar 21 2023 - 13:39:39 EST


vhost_task_create is supposed to return the vhost_task or NULL on
failure. This fixes it to return the correct value when the allocation
of the struct fails.
---
kernel/vhost_task.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/vhost_task.c b/kernel/vhost_task.c
index 4b8aff160640..b7cbd66f889e 100644
--- a/kernel/vhost_task.c
+++ b/kernel/vhost_task.c
@@ -88,7 +88,7 @@ struct vhost_task *vhost_task_create(int (*fn)(void *), void *arg,

vtsk = kzalloc(sizeof(*vtsk), GFP_KERNEL);
if (!vtsk)
- return ERR_PTR(-ENOMEM);
+ return NULL;
init_completion(&vtsk->exited);
vtsk->data = arg;
vtsk->fn = fn;