Skip to contentSkip to conversation

erofs-utils: mkfs: avoid erroring out if `zmgr` is uninitialized

PATCH New Gao Xiang 1 participant 1 message Jun 19, 2025 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: mkfs: avoid erroring out if `zmgr` is uninitialized

Uncompressed images don't initialize zmgr, but it's simpler to unconditionally call z_erofs_compress_exit().

Fixes ce7dd3e61c26 ("erofs-utils: lib: introduce per-FS compression context")
---
 lib/compress.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
lib/compress.c +3 -4
index 2bafb0e..8999b2c 100644
@@ -2130,10 +2130,9 @@ int z_erofs_compress_exit(struct erofs_sb_info *sbi)
 {
 	int i, ret;
 
-	if (!sbi->zmgr) {
-		DBG_BUGON(1);
-		return -EINVAL;
-	}
+	/* If `zmgr` is uninitialized, return directly. */
+	if (!sbi->zmgr)
+		return 0;
 
 	for (i = 0; cfg.c_compr_opts[i].alg; ++i) {
 		ret = erofs_compressor_exit(&sbi->zmgr->ccfg[i].handle);
Signature · 1 line
2.43.5