Skip to contentSkip to conversation

erofs: fix an error code in z_erofs_init_zip_subsystem()

PATCH In review Dan Carpenter 3 participants 3 messages Feb 16, 2023 – Feb 17, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 erofs: fix an error code in z_erofs_init_zip_subsystem()

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

Fixes d8a650adf429 ("erofs: add per-cpu threads for decompression as an option")
---
 fs/erofs/zdata.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/erofs/zdata.c +3 -1
index 8ea3f5fe985e..3247d2422bea 100644
@@ -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)
Signature · 1 line
2.39.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Dan Carpenter

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

Fixes d8a650adf429 ("erofs: add per-cpu threads for decompression as an option")

Thanks,
Gao Xiang

Quoted 20 lines
---
  fs/erofs/zdata.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
fs/erofs/zdata.c +3 -1
index 8ea3f5fe985e..3247d2422bea 100644
@@ -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)
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 4 lines · On Thu, 16 Feb 2023 15:13:04 +0300 Dan Carpenter <[email protected]> wrote:

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

Fixes d8a650adf429 ("erofs: add per-cpu threads for decompression as an option")
Quoted 20 lines
---
 fs/erofs/zdata.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/erofs/zdata.c +3 -1
index 8ea3f5fe985e..3247d2422bea 100644
@@ -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)