Since the variable path has been checked after strndup_user() and will not be reassigned during use, so it does not need to be checked again before free.
No functional change intended. Signed-off-by: Li Zetao <lizet...@huawei.com> --- fs/bcachefs/chardev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c index c315421bee85..ea84aaa7a143 100644 --- a/fs/bcachefs/chardev.c +++ b/fs/bcachefs/chardev.c @@ -320,8 +320,7 @@ static long bch2_ioctl_disk_add(struct bch_fs *c, struct bch_ioctl_disk arg) return PTR_ERR(path); ret = bch2_dev_add(c, path); - if (!IS_ERR(path)) - kfree(path); + kfree(path); return ret; } -- 2.34.1