Date: Thu, 21 Jan 2021 23:20:50 GMT From: Marius Strobl <marius@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 3b433ed76500 - main - mmcsd(4): properly set BIO error when partition switching fails Message-ID: <202101212320.10LNKogm071880@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=3b433ed76500f1dde444bed736f9f36695cb93a0 commit 3b433ed76500f1dde444bed736f9f36695cb93a0 Author: Marius Strobl <marius@FreeBSD.org> AuthorDate: 2021-01-21 23:09:09 +0000 Commit: Marius Strobl <marius@FreeBSD.org> CommitDate: 2021-01-21 23:18:40 +0000 mmcsd(4): properly set BIO error when partition switching fails While at it, remove redundant braces and goto in mmcsd_task(). Reported by: Coverity CID: 1419639 --- sys/dev/mmc/mmcsd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index 2a55a9be1548..5e821586f722 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -1440,6 +1440,7 @@ mmcsd_task(void *arg) mmcbus = sc->mmcbus; while (1) { + bio_error = 0; MMCSD_DISK_LOCK(part); do { if (part->running == 0) @@ -1481,21 +1482,18 @@ mmcsd_task(void *arg) if (block < part->eend && end > part->eblock) part->eblock = part->eend = 0; block = mmcsd_rw(part, bp); - } else if (bp->bio_cmd == BIO_DELETE) { + } else if (bp->bio_cmd == BIO_DELETE) block = mmcsd_delete(part, bp); - } else { + else bio_error = EOPNOTSUPP; - goto release; - } release: MMCBUS_RELEASE_BUS(mmcbus, dev); if (block < end) { bp->bio_error = (bio_error == 0) ? EIO : bio_error; bp->bio_resid = (end - block) * sz; bp->bio_flags |= BIO_ERROR; - } else { + } else bp->bio_resid = 0; - } biodone(bp); } out:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101212320.10LNKogm071880>