From owner-dev-commits-src-main@freebsd.org Wed Sep 22 12:44:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5ADF66A29E; Wed, 22 Sep 2021 12:44:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HDyg54wdcz56gX; Wed, 22 Sep 2021 12:44:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 898001777C; Wed, 22 Sep 2021 12:44:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18MCins0085372; Wed, 22 Sep 2021 12:44:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18MCinjK085371; Wed, 22 Sep 2021 12:44:49 GMT (envelope-from git) Date: Wed, 22 Sep 2021 12:44:49 GMT Message-Id: <202109221244.18MCinjK085371@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 884f38590c3c - main - Fix false device_set_unit() error. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 884f38590c3cc0b1a2c00904c1f1f6c791376308 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 12:44:50 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=884f38590c3cc0b1a2c00904c1f1f6c791376308 commit 884f38590c3cc0b1a2c00904c1f1f6c791376308 Author: Alexander Motin AuthorDate: 2021-09-22 12:42:36 +0000 Commit: Alexander Motin 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);