Re: fs/btrfs/send.c:6877:5-8: Unneeded variable: "ret". Return "0" on line 6883

From: David Sterba
Date: Thu Oct 10 2024 - 07:53:46 EST


On Thu, Oct 10, 2024 at 12:04:53AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 75b607fab38d149f232f01eae5e6392b394dd659
> commit: 38622010a6de3a62cc72688348548854ed82dcf5 btrfs: send: add support for fs-verity
> date: 2 years ago
> config: i386-randconfig-052-20241009 (https://download.01.org/0day-ci/archive/20241009/202410092305.WbyqspH8-lkp@xxxxxxxxx/config)
> compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
>
> 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@xxxxxxxxx>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202410092305.WbyqspH8-lkp@xxxxxxxxx/
>
> cocci warnings: (new ones prefixed by >>)
> >> fs/btrfs/send.c:6877:5-8: Unneeded variable: "ret". Return "0" on line 6883
>
> vim +6877 fs/btrfs/send.c
>
> 6874
> 6875 static int changed_verity(struct send_ctx *sctx, enum btrfs_compare_tree_result result)
> 6876 {
> > 6877 int ret = 0;
> 6878
> 6879 if (!sctx->cur_inode_new_gen && !sctx->cur_inode_deleted) {
> 6880 if (result == BTRFS_COMPARE_TREE_NEW)
> 6881 sctx->cur_inode_needs_verity = true;
> 6882 }
> > 6883 return ret;

Trivial fix if somebody wants to take it. All changed_ callbacks must
return a value but here the verity status is passed via the context so
this should be 'return 0'.