From nobody Sun Dec 01 04:57:07 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 4Y1F5J0gk5z5gDDT; Sun, 01 Dec 2024 04:57:08 +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 4Y1F5H67fyz49DB; Sun, 1 Dec 2024 04:57:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029028; 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=JTz/k+x5nTtNiEIPxijeCENhc/CTyWts2jXO2s8zNDE=; b=gjHqAKy/zbDZViz1rTPQ1QPI4NCrPJ+cqCmCevVN/5MHtHdHb9JSOfbLAoWGFw6FvoQVfo //GdTNjd1w/BOogVFUUUdxFpxN+G3cM82hOXUZWsHiy9E+JxHgFLR2neaK03mBYjsmMr8Z nKvzOxxEYfvxFnLjiD+OHpUo0rCBLlySdZSiIkOq/4wLrHib/bIkSzgnmzr46m/m5ITqBo Cdr3zcpKAjOeycJJSe4ASR8OiUzJ01fv95doKdJ0S7jrWR9vS8COTXH0DgU4JPnGZ0H2Ku KRXzV1Xq7PgoZurs9F/Un3iLwIoQKBsGVB7UTwPdBXryORr8bSIkxWtZQACuzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733029028; 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=JTz/k+x5nTtNiEIPxijeCENhc/CTyWts2jXO2s8zNDE=; b=cbuc7VzgQK5U7bQFAFZEVFR9/RnZtRDycq/5+iR2QCNGAS2lPb14G4h1EC7GmnzHZG5s6w 1x5pfWEsnYNOzUvlp77tpPtMEcehS+LIsJaRSWtoqVyP0IOtMfygityvA6TRjTBx5yJjzV HrbaRErien7Puz3918ve6Tm0jboC0z6AImP/prxR+WmZHu3I1QFKI+fw04cNQCYzNZcKGj fNYGptMo1+15rFcAZ5SQ41ZhsHUd6SsaXtDmlOOU/kWy6Wej01Y4EffaycodL39xZ+K94S g6vVVA9xeeJqxKGhyLdBnYN4s8jA3OocgGDAnWLu13B8NrqSLSMutEn7wOlkcQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733029028; a=rsa-sha256; cv=none; b=uB4fZBHNWseFXprJ+JUbN32vu3imWID8mVHA1fKPwO/tRl1/05uBGQhcJtwLG5yLr/s3Xy fXtdUrwj0YNyA3e4AmzCgnEpmHOKps3lLbJz7Ds5we7T7r9CaDUbptsj3fDcGktcAwZ/O+ m+zJSiFfYVp99IxYEOBHilkmRfJE1+WirXTaRdnkwDoiXpLugA1f0ehaIOC+qu9qXj4/qn wR4QxWUe9YQradDbDnLAbKGdoghVJAvwBkVC3A0NGUB5Xp2udKhO0MwgCa7IvTJUWFKX66 AUyC/XxE+UhbIAXRcFyfZMJE5q9T79JIZbY4oh173OP6af4lZszNW2szlwAlhQ== 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 4Y1F5H5G2LzdwY; Sun, 1 Dec 2024 04:57:07 +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 4B14v7Gp095000; Sun, 1 Dec 2024 04:57:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B14v7HO094997; Sun, 1 Dec 2024 04:57:07 GMT (envelope-from git) Date: Sun, 1 Dec 2024 04:57:07 GMT Message-Id: <202412010457.4B14v7HO094997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: e09c819e6a4c - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: e09c819e6a4ceb6babc51057e12afa792569342f Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=e09c819e6a4ceb6babc51057e12afa792569342f commit e09c819e6a4ceb6babc51057e12afa792569342f Author: John Baldwin AuthorDate: 2024-10-31 19:49:41 +0000 Commit: John Baldwin CommitDate: 2024-12-01 02:46:05 +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 (cherry picked from commit 13a1dbfed57b167a6dc4d68b60115eb0e070b9b6) --- 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 d3c3664af78c..e034ab278f40 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);