summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-12-15 00:05:47 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:18 +0300
commit2a863c6c80e3c14eb3920c0d8474ba112c82197a (patch)
tree2638d7e8dbab59ba3c746ab1b0f79a764c523c6b
parentdbd8b46b90852c0dbaffc48fc1d8b3869b078cf2 (diff)
downloadlinux-2a863c6c80e3c14eb3920c0d8474ba112c82197a.tar.xz
bcachefs: Fix debug build in userspace
This fixes some compiler warnings that only trigger in userspace - dead code, a maybe uninitialed variable, a maybe null ptr passed to printk. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/bcachefs/btree_io.c3
-rw-r--r--fs/bcachefs/dirent.c2
-rw-r--r--fs/bcachefs/inode.c10
3 files changed, 3 insertions, 12 deletions
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index f01f78952942..5a678e6e993a 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -560,7 +560,8 @@ enum btree_validate_ret {
\
switch (write) { \
case READ: \
- bch_err(c, "%s", _buf2); \
+ if (_buf2) \
+ bch_err(c, "%s", _buf2); \
\
switch (type) { \
case BTREE_ERR_FIXABLE: \
diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c
index a165d08c3668..6f699b736b34 100644
--- a/fs/bcachefs/dirent.c
+++ b/fs/bcachefs/dirent.c
@@ -230,7 +230,7 @@ int bch2_dirent_rename(struct btree_trans *trans,
{
struct btree_iter src_iter = { NULL };
struct btree_iter dst_iter = { NULL };
- struct bkey_s_c old_src, old_dst;
+ struct bkey_s_c old_src, old_dst = bkey_s_c_null;
struct bkey_i_dirent *new_src = NULL, *new_dst = NULL;
struct bpos dst_pos =
POS(dst_dir.inum, bch2_dirent_hash(dst_hash, dst_name));
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c
index fb5ed3a07ad7..d9ccc7c063ac 100644
--- a/fs/bcachefs/inode.c
+++ b/fs/bcachefs/inode.c
@@ -24,16 +24,6 @@ const char * const bch2_inode_opts[] = {
};
static const u8 byte_table[8] = { 1, 2, 3, 4, 6, 8, 10, 13 };
-static const u8 bits_table[8] = {
- 1 * 8 - 1,
- 2 * 8 - 2,
- 3 * 8 - 3,
- 4 * 8 - 4,
- 6 * 8 - 5,
- 8 * 8 - 6,
- 10 * 8 - 7,
- 13 * 8 - 8,
-};
static int inode_decode_field(const u8 *in, const u8 *end,
u64 out[2], unsigned *out_bits)