git: 0bd7300e598b - stable/13 - Fix false device_set_unit() error.

Alexander Motin mav at FreeBSD.org
Wed Sep 29 00:44:31 UTC 2021


The branch stable/13 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=0bd7300e598bb8ea8c97c397809a6c3a019c4e71

commit 0bd7300e598bb8ea8c97c397809a6c3a019c4e71
Author:     Alexander Motin <mav at FreeBSD.org>
AuthorDate: 2021-09-22 12:42:36 +0000
Commit:     Alexander Motin <mav at FreeBSD.org>
CommitDate: 2021-09-29 00:44:29 +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
    
    (cherry picked from commit 884f38590c3cc0b1a2c00904c1f1f6c791376308)
---
 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 5bd3a4f3d450..da78a9cb839f 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -3092,6 +3092,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);


More information about the dev-commits-src-all mailing list