]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: remove unnecessary NULL check for the new inode during rename exchange
authorFilipe Manana <fdmanana@suse.com>
Thu, 29 Jul 2021 14:28:34 +0000 (15:28 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Aug 2021 11:19:10 +0000 (13:19 +0200)
commitc0e7a5ff7f8b106631d2876fd512fd18007afd0f
treed72b04141ceae448bfb984d7d23759178838291a
parentb6a495eebee768ac97205d0241d70b88cfdc3a6e
btrfs: remove unnecessary NULL check for the new inode during rename exchange

At the very end of btrfs_rename_exchange(), in case an error happened, we
are checking if 'new_inode' is NULL, but that is not needed since during a
rename exchange, unlike regular renames, 'new_inode' can never be NULL,
and if it were, we would have a crashed much earlier when we dereference it
multiple times.

So remove the check because it is not necessary and because it is causing
static checkers to emit a warning. I probably introduced the check by
copy-pasting similar code from btrfs_rename(), where 'new_inode' can be
NULL, in commit 024d26ba723434 ("Btrfs: unpin logs if rename exchange
operation fails").

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c