[PATCH] erofs: fix an error code in z_erofs_init_zip_subsystem()

Dan Carpenter error27 at gmail.com
Thu Feb 16 23:13:04 AEDT 2023


Return -ENOMEM if alloc_workqueue() fails.  Don't return success.

Fixes: d8a650adf429 ("erofs: add per-cpu threads for decompression as an option")
Signed-off-by: Dan Carpenter <error27 at gmail.com>
---
 fs/erofs/zdata.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index 8ea3f5fe985e..3247d2422bea 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -475,8 +475,10 @@ int __init z_erofs_init_zip_subsystem(void)
 
 	z_erofs_workqueue = alloc_workqueue("erofs_worker",
 			WQ_UNBOUND | WQ_HIGHPRI, num_possible_cpus());
-	if (!z_erofs_workqueue)
+	if (!z_erofs_workqueue) {
+		err = -ENOMEM;
 		goto out_error_workqueue_init;
+	}
 
 	err = erofs_init_percpu_workers();
 	if (err)
-- 
2.39.1



More information about the Linux-erofs mailing list