Skip to content

Commit 5ad585b

Browse files
Yu Jiaoliangtytso
authored andcommitted
ext4: use ERR_CAST to return an error-valued pointer
Instead of directly casting and returning an error-valued pointer, use ERR_CAST to make the error handling more explicit and improve code clarity. Signed-off-by: Yu Jiaoliang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 52aecae commit 5ad585b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ext4/namei.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ static struct buffer_head * ext4_dx_find_entry(struct inode *dir,
17471747
#endif
17481748
frame = dx_probe(fname, dir, NULL, frames);
17491749
if (IS_ERR(frame))
1750-
return (struct buffer_head *) frame;
1750+
return ERR_CAST(frame);
17511751
do {
17521752
block = dx_get_block(frame->at);
17531753
bh = ext4_read_dirblock(dir, block, DIRENT_HTREE);
@@ -1952,7 +1952,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir,
19521952
if (IS_ERR(bh2)) {
19531953
brelse(*bh);
19541954
*bh = NULL;
1955-
return (struct ext4_dir_entry_2 *) bh2;
1955+
return ERR_CAST(bh2);
19561956
}
19571957

19581958
BUFFER_TRACE(*bh, "get_write_access");

0 commit comments

Comments
 (0)