[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202408262018.bWsiI6Oz-lkp@intel.com>
Date: Mon, 26 Aug 2024 20:47:43 +0800
From: kernel test robot <lkp@...el.com>
To: Kent Overstreet <kent.overstreet@...ux.dev>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: fs/bcachefs/disk_accounting.c:136:5-8: Unneeded variable: "ret".
Return "0" on line 184
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5be63fc19fcaa4c236b307420483578a56986a37
commit: 077e47372309dcbe3a150754ea9c6f15cc838d6b bcachefs: bch2_accounting_invalid()
date: 2 weeks ago
config: i386-randconfig-053-20240826 (https://download.01.org/0day-ci/archive/20240826/202408262018.bWsiI6Oz-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408262018.bWsiI6Oz-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> fs/bcachefs/disk_accounting.c:136:5-8: Unneeded variable: "ret". Return "0" on line 184
vim +136 fs/bcachefs/disk_accounting.c
128
129 int bch2_accounting_invalid(struct bch_fs *c, struct bkey_s_c k,
130 enum bch_validate_flags flags,
131 struct printbuf *err)
132 {
133 struct disk_accounting_pos acc_k;
134 bpos_to_disk_accounting_pos(&acc_k, k.k->p);
135 void *end = &acc_k + 1;
> 136 int ret = 0;
137
138 switch (acc_k.type) {
139 case BCH_DISK_ACCOUNTING_nr_inodes:
140 end = field_end(acc_k, nr_inodes);
141 break;
142 case BCH_DISK_ACCOUNTING_persistent_reserved:
143 end = field_end(acc_k, persistent_reserved);
144 break;
145 case BCH_DISK_ACCOUNTING_replicas:
146 bkey_fsck_err_on(!acc_k.replicas.nr_devs,
147 c, err, accounting_key_replicas_nr_devs_0,
148 "accounting key replicas entry with nr_devs=0");
149
150 bkey_fsck_err_on(acc_k.replicas.nr_required > acc_k.replicas.nr_devs ||
151 (acc_k.replicas.nr_required > 1 &&
152 acc_k.replicas.nr_required == acc_k.replicas.nr_devs),
153 c, err, accounting_key_replicas_nr_required_bad,
154 "accounting key replicas entry with bad nr_required");
155
156 for (unsigned i = 0; i + 1 < acc_k.replicas.nr_devs; i++)
157 bkey_fsck_err_on(acc_k.replicas.devs[i] > acc_k.replicas.devs[i + 1],
158 c, err, accounting_key_replicas_devs_unsorted,
159 "accounting key replicas entry with unsorted devs");
160
161 end = (void *) &acc_k.replicas + replicas_entry_bytes(&acc_k.replicas);
162 break;
163 case BCH_DISK_ACCOUNTING_dev_data_type:
164 end = field_end(acc_k, dev_data_type);
165 break;
166 case BCH_DISK_ACCOUNTING_compression:
167 end = field_end(acc_k, compression);
168 break;
169 case BCH_DISK_ACCOUNTING_snapshot:
170 end = field_end(acc_k, snapshot);
171 break;
172 case BCH_DISK_ACCOUNTING_btree:
173 end = field_end(acc_k, btree);
174 break;
175 case BCH_DISK_ACCOUNTING_rebalance_work:
176 end = field_end(acc_k, rebalance_work);
177 break;
178 }
179
180 bkey_fsck_err_on(!is_zero(end, (void *) (&acc_k + 1)),
181 c, err, accounting_key_junk_at_end,
182 "junk at end of accounting key");
183 fsck_err:
> 184 return ret;
185 }
186
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists