diff options
| author | Jiangshan Yi <yijiangshan@kylinos.cn> | 2026-09-07 18:16:23 +0800 |
|---|---|---|
| committer | Namjae Jeon <linkinjeon@kernel.org> | 2026-10-20 18:41:39 +0900 |
| commit | 34ed307206e3eef231cb06454d4e89cefb9bfccd (patch) | |
| tree | 59093e5f9f55fe6194e05f6248a4cd2fb5b6184b | |
| parent | 338abaf0dc9230a6627de1a532b7fea5f13623eb (diff) | |
ntfs: remove unreachable code in load_and_init_attrdef/upcase
Both load_and_init_attrdef() and load_and_init_upcase() open a system
inode with ntfs_iget() and, on error, run:
if (IS_ERR(ino)) {
if (!IS_ERR(ino))
iput(ino);
goto failed;
}
The inner guard is the exact negation of the outer one, so
iput(ino) is dead code. Drop the unreachable branch and collapse
the error check to a single statement.
No functional change.
Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
Reviewed-by: Baolin Liu <liubaolin@kylinos.cn>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
| -rw-r--r-- | fs/ntfs/super.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 9f5cf65fd3a5..f7b3140049c4 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -1303,11 +1303,8 @@ static bool load_and_init_attrdef(struct ntfs_volume *vol) ntfs_debug("Entering."); /* Read attrdef table and setup vol->attrdef and vol->attrdef_size. */ ino = ntfs_iget(sb, FILE_AttrDef); - if (IS_ERR(ino)) { - if (!IS_ERR(ino)) - iput(ino); + if (IS_ERR(ino)) goto failed; - } NInoSetSparseDisabled(NTFS_I(ino)); /* FILE_AttrDef must hold at least one entry and fit inside 31 bits. */ i_size = i_size_read(ino); @@ -1369,11 +1366,8 @@ static bool load_and_init_upcase(struct ntfs_volume *vol) ntfs_debug("Entering."); /* Read upcase table and setup vol->upcase and vol->upcase_len. */ ino = ntfs_iget(sb, FILE_UpCase); - if (IS_ERR(ino)) { - if (!IS_ERR(ino)) - iput(ino); + if (IS_ERR(ino)) goto upcase_failed; - } /* * The upcase size must not be above 64k Unicode characters, must not * be zero and must be a multiple of sizeof(__le16). |
