Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Sep 2021 12:44:49 GMT
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 884f38590c3c - main - Fix false device_set_unit() error.
Message-ID:  <202109221244.18MCinjK085371@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=884f38590c3cc0b1a2c00904c1f1f6c791376308

commit 884f38590c3cc0b1a2c00904c1f1f6c791376308
Author:     Alexander Motin <mav@FreeBSD.org>
AuthorDate: 2021-09-22 12:42:36 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2021-09-22 12:44:39 +0000

    Fix false device_set_unit() error.
    
    It should silently succeed if the current unit number is the same as
    requested, not fail immediately.
    
    MFC after:      1 week
---
 sys/kern/subr_bus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 1f580f455dc0..5e1b561155bb 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3145,6 +3145,8 @@ device_set_unit(device_t dev, int unit)
 	devclass_t dc;
 	int err;
 
+	if (unit == dev->unit)
+		return (0);
 	dc = device_get_devclass(dev);
 	if (unit < dc->maxunit && dc->devices[unit])
 		return (EBUSY);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109221244.18MCinjK085371>