Skip to content

Commit f764c58

Browse files
Chi Zhilingnamjaejeon
authored andcommitted
exfat: remove NULL cache pointer case in exfat_ent_get
Since exfat_get_next_cluster has been updated, no callers pass a NULL pointer to exfat_ent_get, so remove the handling logic for this case. Signed-off-by: Chi Zhiling <chizhiling@kylinos.cn> Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com> Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent 6f2cbe4 commit f764c58

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

fs/exfat/fatent.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,19 @@ static int exfat_end_bh(struct super_block *sb, struct buffer_head *bh)
4444
}
4545

4646
static int __exfat_ent_get(struct super_block *sb, unsigned int loc,
47-
unsigned int *content, struct buffer_head **last)
47+
unsigned int *content, struct buffer_head **cache)
4848
{
4949
unsigned int off;
5050
sector_t sec;
51-
struct buffer_head *bh = last ? *last : NULL;
51+
struct buffer_head *bh = *cache;
5252

5353
sec = FAT_ENT_OFFSET_SECTOR(sb, loc);
5454
off = FAT_ENT_OFFSET_BYTE_IN_SECTOR(sb, loc);
5555

5656
if (!bh || bh->b_blocknr != sec || !buffer_uptodate(bh)) {
5757
brelse(bh);
5858
bh = sb_bread(sb, sec);
59-
if (last)
60-
*last = bh;
59+
*cache = bh;
6160
if (unlikely(!bh))
6261
return -EIO;
6362
}
@@ -68,8 +67,6 @@ static int __exfat_ent_get(struct super_block *sb, unsigned int loc,
6867
if (*content > EXFAT_BAD_CLUSTER)
6968
*content = EXFAT_EOF_CLUSTER;
7069

71-
if (!last)
72-
brelse(bh);
7370
return 0;
7471
}
7572

@@ -111,7 +108,7 @@ int exfat_ent_set(struct super_block *sb, unsigned int loc,
111108
* Caller must release the buffer_head if no error return.
112109
*/
113110
int exfat_ent_get(struct super_block *sb, unsigned int loc,
114-
unsigned int *content, struct buffer_head **last)
111+
unsigned int *content, struct buffer_head **cache)
115112
{
116113
struct exfat_sb_info *sbi = EXFAT_SB(sb);
117114

@@ -122,7 +119,7 @@ int exfat_ent_get(struct super_block *sb, unsigned int loc,
122119
goto err;
123120
}
124121

125-
if (unlikely(__exfat_ent_get(sb, loc, content, last))) {
122+
if (unlikely(__exfat_ent_get(sb, loc, content, cache))) {
126123
exfat_fs_error_ratelimit(sb,
127124
"failed to access to FAT (entry 0x%08x)",
128125
loc);
@@ -151,13 +148,11 @@ int exfat_ent_get(struct super_block *sb, unsigned int loc,
151148
}
152149

153150
return 0;
154-
err:
155-
if (last) {
156-
brelse(*last);
157151

158-
/* Avoid double release */
159-
*last = NULL;
160-
}
152+
err:
153+
/* Avoid double release */
154+
brelse(*cache);
155+
*cache = NULL;
161156
return -EIO;
162157
}
163158

0 commit comments

Comments
 (0)