mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 04:21:09 -04:00
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>
This commit is contained in:
@@ -44,11 +44,11 @@ static int exfat_end_bh(struct super_block *sb, struct buffer_head *bh)
|
||||
}
|
||||
|
||||
static int __exfat_ent_get(struct super_block *sb, unsigned int loc,
|
||||
unsigned int *content, struct buffer_head **last)
|
||||
unsigned int *content, struct buffer_head **cache)
|
||||
{
|
||||
unsigned int off;
|
||||
sector_t sec;
|
||||
struct buffer_head *bh = last ? *last : NULL;
|
||||
struct buffer_head *bh = *cache;
|
||||
|
||||
sec = FAT_ENT_OFFSET_SECTOR(sb, loc);
|
||||
off = FAT_ENT_OFFSET_BYTE_IN_SECTOR(sb, loc);
|
||||
@@ -56,8 +56,7 @@ static int __exfat_ent_get(struct super_block *sb, unsigned int loc,
|
||||
if (!bh || bh->b_blocknr != sec || !buffer_uptodate(bh)) {
|
||||
brelse(bh);
|
||||
bh = sb_bread(sb, sec);
|
||||
if (last)
|
||||
*last = bh;
|
||||
*cache = bh;
|
||||
if (unlikely(!bh))
|
||||
return -EIO;
|
||||
}
|
||||
@@ -68,8 +67,6 @@ static int __exfat_ent_get(struct super_block *sb, unsigned int loc,
|
||||
if (*content > EXFAT_BAD_CLUSTER)
|
||||
*content = EXFAT_EOF_CLUSTER;
|
||||
|
||||
if (!last)
|
||||
brelse(bh);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -111,7 +108,7 @@ int exfat_ent_set(struct super_block *sb, unsigned int loc,
|
||||
* Caller must release the buffer_head if no error return.
|
||||
*/
|
||||
int exfat_ent_get(struct super_block *sb, unsigned int loc,
|
||||
unsigned int *content, struct buffer_head **last)
|
||||
unsigned int *content, struct buffer_head **cache)
|
||||
{
|
||||
struct exfat_sb_info *sbi = EXFAT_SB(sb);
|
||||
|
||||
@@ -122,7 +119,7 @@ int exfat_ent_get(struct super_block *sb, unsigned int loc,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (unlikely(__exfat_ent_get(sb, loc, content, last))) {
|
||||
if (unlikely(__exfat_ent_get(sb, loc, content, cache))) {
|
||||
exfat_fs_error_ratelimit(sb,
|
||||
"failed to access to FAT (entry 0x%08x)",
|
||||
loc);
|
||||
@@ -151,13 +148,11 @@ int exfat_ent_get(struct super_block *sb, unsigned int loc,
|
||||
}
|
||||
|
||||
return 0;
|
||||
err:
|
||||
if (last) {
|
||||
brelse(*last);
|
||||
|
||||
/* Avoid double release */
|
||||
*last = NULL;
|
||||
}
|
||||
err:
|
||||
/* Avoid double release */
|
||||
brelse(*cache);
|
||||
*cache = NULL;
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user