[PATCH] vduse: Fix missing error code in vduse_init()

From: Jiapeng Chong
Date: Thu Sep 09 2021 - 05:53:36 EST


From: chongjiapeng <jiapeng.chong@xxxxxxxxxxxxxxxxx>

The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'ret'.

Eliminate the follow smatch warning:

drivers/vdpa/vdpa_user/vduse_dev.c:1597 vduse_init() warn: missing error
code 'ret'.

Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
Fixes: c8a6153b6c59 ("vduse: Introduce VDUSE - vDPA Device in Userspace")
Signed-off-by: chongjiapeng <jiapeng.chong@xxxxxxxxxxxxxxxxx>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 5c25ff6..6a8878d 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -1593,8 +1593,10 @@ static int vduse_init(void)

vduse_irq_wq = alloc_workqueue("vduse-irq",
WQ_HIGHPRI | WQ_SYSFS | WQ_UNBOUND, 0);
- if (!vduse_irq_wq)
+ if (!vduse_irq_wq) {
+ ret = -EINVAL;
goto err_wq;
+ }

ret = vduse_domain_init();
if (ret)
--
1.8.3.1