makefs: do not call brelse if bread returns an error

If bread returns an error there is no bp to brelse.  One of these
changes was taken from NetBSD commit 0a62dad69f62 ("This works well
enough to populate..."), the rest were found by looking for the same
pattern.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39069
This commit is contained in:
Ed Maste 2023-03-13 16:51:51 -04:00
parent 91b2da1370
commit bc33c99234
2 changed files with 0 additions and 6 deletions

View File

@ -305,7 +305,6 @@ ffs_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
error = bread((void *)ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
(int)fs->fs_cgsize, NULL, &bp);
if (error) {
brelse(bp);
return (0);
}
cgp = (struct cg *)bp->b_data;
@ -449,7 +448,6 @@ ffs_blkfree(struct inode *ip, daddr_t bno, long size)
error = bread((void *)ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
(int)fs->fs_cgsize, NULL, &bp);
if (error) {
brelse(bp);
return;
}
cgp = (struct cg *)bp->b_data;

View File

@ -125,7 +125,6 @@ createde(struct denode *dep, struct denode *ddep, struct denode **depp,
diroffset &= pmp->pm_crbomask;
if ((error = bread((void *)pmp->pm_devvp, bn, blsize, NOCRED,
&bp)) != 0) {
brelse(bp);
return error;
}
ndep = bptoep(pmp, bp, ddep->de_fndoffset);
@ -157,7 +156,6 @@ createde(struct denode *dep, struct denode *ddep, struct denode **depp,
error = bread((void *)pmp->pm_devvp, bn, blsize,
NOCRED, &bp);
if (error) {
brelse(bp);
return error;
}
ndep = bptoep(pmp, bp, ddep->de_fndoffset);
@ -213,7 +211,6 @@ m_readep(struct msdosfsmount *pmp, u_long dirclust, u_long diroffset,
bn = detobn(pmp, dirclust, diroffset);
if ((error = bread((void *)pmp->pm_devvp, bn, blsize, NOCRED,
bpp)) != 0) {
brelse(*bpp);
*bpp = NULL;
return (error);
}
@ -274,7 +271,6 @@ uniqdosname(struct denode *dep, struct componentname *cnp, u_char *cp)
error = bread((void *)pmp->pm_devvp, bn, blsize,
NOCRED, &bp);
if (error) {
brelse(bp);
return error;
}
for (dentp = (struct direntry *)bp->b_data;