From nobody Thu Oct 31 19:52:58 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XfZRG56Hvz5cHQk; Thu, 31 Oct 2024 19:52:58 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XfZRG3P53z4PpN; Thu, 31 Oct 2024 19:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730404378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wQ6qH77a+WKL+SG14Er/fpsApgXe6Nx1zWp03fpKtk0=; b=faTK9dLIN39lfeUx8PQwC5vcONM+lrHeNpPRvf9gmH/FyJI55324fBCJ2P5YX3U4jtED8Y MDL3RtQz7RhsDe6Q+ikmF2WjmLJ7qqV/3RZhualz3Tyo2Q26vyZf8+kOGVIGUZJSpjS+cw GDe3FIXqmKs3lDeHY8OQKvcTMsSUxCUoCU2hJYcgRcLR5nRIbiZVjHpCpGUZuCCXZguvYK ywsrcWuIjE8SzbkdwOSNB5CUh8swnI73L6i26NsMWITXvUwSD2JfDQy7DMOwjOHBf2CBxR zZvyS2mRiJMbyaWHylywZQ5mxN1PEwtVmMUAgQcCnYH7oivlT/BMUIClDSjaOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730404378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wQ6qH77a+WKL+SG14Er/fpsApgXe6Nx1zWp03fpKtk0=; b=FJrAuY8b4lSxGN2lFL6qLS0LsEbPds5JUm24WL9fwIWcR2LKXRbLtmgB4wE6hhRVRUA1CB 8o80xE/+Hfiba1p6ABYJu3XSO/pAHeXNLdoD/fQspwzvSt62jFay7eQTGTo5NcXwrHPvYH G/I+6hBWdEsOJgBajd0rxueUbeiQKoBC0fB6D0Hbm8Rp6mUqTnFHASCej3QrZOXoaaqX09 JNzM6doIxrTIUmb4EensHiyIzHOrYfJ6MRV5mbRKg/OWcYnkZgWrWqQFYQxv/1Q9GmajUq ehpPvOeHHE5B9voAjzOUWsmzvvg9Ltsrm5rPT/dk3ovd1vNiBBOfnxaVyws4tg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730404378; a=rsa-sha256; cv=none; b=SH1h6pAjNZZtwb6HIPcHUgFC4/z1RX42jMCpSrcKR1wqDiIF0I7jXn13iUw+XIkPNBoEwU 4fxkMDOf36Y6daG3gjeyAxS+nAMOK6P8kgOkCltwNC2Hvo4c5Q+bBGZIKEqR2EO5X1tJCi sappG7vAK+qJhXp/Ns9QVr9GtINYzgTKNET966xwvrVMqoVPipxJpgEkF37uNE7MWA1/w8 IHavDLIwthl/BeQW3EuW38uW1EcwFyFY9y8m4hELpYzUWNYA43cbnafyIjap9lRc3J4J7H i9OryC1LtPi8IC2tmZs9IedTo5vA+pYFSCSwt3O7WP1Q+F3N3OoVMKDcLSwHHA== 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 4XfZRG2kPZzqNV; Thu, 31 Oct 2024 19:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49VJqwj7006033; Thu, 31 Oct 2024 19:52:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VJqwhD006030; Thu, 31 Oct 2024 19:52:58 GMT (envelope-from git) Date: Thu, 31 Oct 2024 19:52:58 GMT Message-Id: <202410311952.49VJqwhD006030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 13a1dbfed57b - main - vf_i2c: Don't hold a mutex across bus_generic_detach List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13a1dbfed57b167a6dc4d68b60115eb0e070b9b6 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=13a1dbfed57b167a6dc4d68b60115eb0e070b9b6 commit 13a1dbfed57b167a6dc4d68b60115eb0e070b9b6 Author: John Baldwin AuthorDate: 2024-10-31 19:49:41 +0000 Commit: John Baldwin CommitDate: 2024-10-31 19:49:41 +0000 vf_i2c: Don't hold a mutex across bus_generic_detach This was also leaking the lock if bus_generic_detach failed. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47221 --- sys/dev/iicbus/controller/vybrid/vf_i2c.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/dev/iicbus/controller/vybrid/vf_i2c.c b/sys/dev/iicbus/controller/vybrid/vf_i2c.c index 0a0b9d0cb35a..ea0e1eeac7fb 100644 --- a/sys/dev/iicbus/controller/vybrid/vf_i2c.c +++ b/sys/dev/iicbus/controller/vybrid/vf_i2c.c @@ -207,13 +207,6 @@ i2c_detach(device_t dev) sc = device_get_softc(dev); vf_i2c_dbg(sc, "i2c detach\n"); - mtx_lock(&sc->mutex); - - if (sc->freq == 0) { - vf_i2c_dbg(sc, "Writing 0x00 to clock divider register\n"); - WRITE1(sc, I2C_IBFD, 0x00); - } - error = bus_generic_detach(dev); if (error != 0) { device_printf(dev, "cannot detach child devices.\n"); @@ -226,6 +219,13 @@ i2c_detach(device_t dev) return (error); } + mtx_lock(&sc->mutex); + + if (sc->freq == 0) { + vf_i2c_dbg(sc, "Writing 0x00 to clock divider register\n"); + WRITE1(sc, I2C_IBFD, 0x00); + } + bus_release_resources(dev, i2c_spec, sc->res); mtx_unlock(&sc->mutex);