}
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);
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;
}
if (*content > EXFAT_BAD_CLUSTER)
*content = EXFAT_EOF_CLUSTER;
- if (!last)
- brelse(bh);
return 0;
}
* 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);
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);
}
return 0;
-err:
- if (last) {
- brelse(*last);
- /* Avoid double release */
- *last = NULL;
- }
+err:
+ /* Avoid double release */
+ brelse(*cache);
+ *cache = NULL;
return -EIO;
}