diff options
author | Huang Jianan <huangjianan@oppo.com> | 2021-09-03 21:40:32 +0800 |
---|---|---|
committer | Gao Xiang <xiang@kernel.org> | 2021-09-03 23:23:41 +0800 |
commit | fe19cf795db870e0019affd6f76defe8f10f34df (patch) | |
tree | 18455e73e17a47fdaf6ed47cb02cbde9ceb41b73 /lib | |
parent | 13439dff8caa908f6a04fba790aae462df31bd7b (diff) | |
download | erofs-utils-fe19cf795db870e0019affd6f76defe8f10f34df.tar.gz |
erofs-utils: fix general style problem
Link: https://lore.kernel.org/r/20210903134035.12507-4-jnhuang95@gmail.com
Signed-off-by: Huang Jianan <huangjianan@oppo.com>
Signed-off-by: Gao Xiang <xiang@kernel.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/block_list.c | 5 | ||||
-rw-r--r-- | lib/compress.c | 9 | ||||
-rw-r--r-- | lib/compressor.c | 2 | ||||
-rw-r--r-- | lib/namei.c | 3 | ||||
-rw-r--r-- | lib/xattr.c | 2 |
5 files changed, 9 insertions, 12 deletions
diff --git a/lib/block_list.c b/lib/block_list.c index 73c1bde..15bb5cf 100644 --- a/lib/block_list.c +++ b/lib/block_list.c @@ -11,13 +11,10 @@ #define pr_fmt(fmt) "EROFS block_list: " FUNC_LINE_FMT fmt "\n" #include "erofs/print.h" -static FILE *block_list_fp = NULL; +static FILE *block_list_fp; int erofs_droid_blocklist_fopen(void) { - if (block_list_fp) - return 0; - block_list_fp = fopen(cfg.block_list_file, "w"); if (!block_list_fp) diff --git a/lib/compress.c b/lib/compress.c index 5ac9427..6df30ea 100644 --- a/lib/compress.c +++ b/lib/compress.c @@ -292,13 +292,12 @@ static void *write_compacted_indexes(u8 *out, bool update_blkaddr; erofs_blk_t blkaddr; - if (destsize == 4) { + if (destsize == 4) vcnt = 2; - } else if (destsize == 2 && logical_clusterbits == 12) { + else if (destsize == 2 && logical_clusterbits == 12) vcnt = 16; - } else { + else return ERR_PTR(-EINVAL); - } encodebits = (vcnt * destsize * 8 - 32) / vcnt; blkaddr = *blkaddr_ret; update_blkaddr = erofs_sb_has_big_pcluster(); @@ -467,8 +466,8 @@ int erofs_write_compressed_file(struct erofs_inode *inode) erofs_blk_t blkaddr, compressed_blocks; unsigned int legacymetasize; int ret, fd; - u8 *compressmeta = malloc(vle_compressmeta_capacity(inode->i_size)); + if (!compressmeta) return -ENOMEM; diff --git a/lib/compressor.c b/lib/compressor.c index c14fc05..1f1a33d 100644 --- a/lib/compressor.c +++ b/lib/compressor.c @@ -26,7 +26,7 @@ int erofs_compress_destsize(struct erofs_compress *c, void *dst, unsigned int dstsize) { - unsigned uncompressed_size; + unsigned int uncompressed_size; int ret; DBG_BUGON(!c->alg); diff --git a/lib/namei.c b/lib/namei.c index 755a5ad..f96e400 100644 --- a/lib/namei.c +++ b/lib/namei.c @@ -243,7 +243,8 @@ static int link_path_walk(const char *name, struct nameidata *nd) name = p; /* Skip until no more slashes. */ - for (name = p; *name == '/'; ++name); + for (name = p; *name == '/'; ++name) + ; } return 0; } diff --git a/lib/xattr.c b/lib/xattr.c index ffc5f7a..196133a 100644 --- a/lib/xattr.c +++ b/lib/xattr.c @@ -215,7 +215,7 @@ static struct xattr_item *erofs_get_selabel_xattr(const char *srcpath, erofs_fspath(srcpath)); else #endif - ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath)); + ret = asprintf(&fspath, "/%s", erofs_fspath(srcpath)); if (ret <= 0) return ERR_PTR(-ENOMEM); |