From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E30574EA37C for ; Tue, 19 May 2026 10:40:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779187213; cv=none; b=uCfLdW3z4B9EAf9KIWKYEiaGHgho36QS8KZsqR4lwGaV++1zn0gMydkxPfwUmC/XRmN3pU6eM8/qFIfFAOwuHsONHNicqG6I3/MPYaONiJsVESlc6lHvfo8dobWMqy0y0zbmHrxj+2aS/BR5scXiXmMVJTIFo0vZrzttGY6v5YM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779187213; c=relaxed/simple; bh=qHB83P1BcywxHtzM+xd8Qesw8ilxFic4NK+311Fec5Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uxJ/LvF6wde0mYKoO8SWyU+iawkPGVXkz7KcBj8X/jNUp4EMSXyGnOXIJyXztj07Osd0Wf2Mv8bTfi3Y43nOB21gC4WH5MRpfpcnzeZJF0gECY9Zcj1dERYUsGuR1uyNgoIVo8fYywsdARDfeRmnDOxNpDgMgxy3Bwr+wFulwjA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jirzJM4C; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jirzJM4C" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 608FCC2BCB3; Tue, 19 May 2026 10:40:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779187212; bh=qHB83P1BcywxHtzM+xd8Qesw8ilxFic4NK+311Fec5Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jirzJM4C8cuRbwhFSbLwu1sTaYnOv6X+h5nOT4IOUz/BJs8FJRioadxCrRm46jKY1 TNPGbTYAtfTOsPzWEvQCBo1evYrNEaFZQEozs0Gx1LBcqRM/kei48Nw3dGf38QQygl XFWlpFHqkzU3XVNHw8QshsOFUcy8fTzJLE3JwsuwGX2unuhWmYBp0DY+czV4H/tKCz Qd3F72l8BB1Qlfs8tT51y4bZjdR7ar/H9Wg+/6UX3bliEYkbIn9CuEpX/4PoYC7UOn JEVpBxC+rkr9FMjGNyylssWQoXpGhb6D2BiGPVmr5qwThgbV5RaHczt1XKCVV5eYAh S34hkN6A/Yh+w== Date: Tue, 19 May 2026 11:40:08 +0100 From: Mark Brown To: Bartosz Golaszewski Cc: Liam Girdwood , Jon Hunter , linux-kernel@vger.kernel.org Subject: Re: [PATCH] regulator: core: lock device when calling device_is_bound() Message-ID: <766cad6e-e553-4ede-9e5c-e03d46b979e2@sirena.org.uk> References: <20260518102015.51704-1-bartosz.golaszewski@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="keHcrgmhSmEvLHlr" Content-Disposition: inline In-Reply-To: <20260518102015.51704-1-bartosz.golaszewski@oss.qualcomm.com> X-Cookie: Huh? --keHcrgmhSmEvLHlr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, May 18, 2026 at 12:20:15PM +0200, Bartosz Golaszewski wrote: > @@ -2240,10 +2240,12 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) > * device get probe deferred and unregisters the supply. > */ > if (r->dev.parent && r->dev.parent != rdev->dev.parent) { > - if (!device_is_bound(r->dev.parent)) { > - put_device(&r->dev); > - ret = -EPROBE_DEFER; > - goto out; > + scoped_guard(device, r->dev.parent) { > + if (!device_is_bound(r->dev.parent)) { > + put_device(&r->dev); > + ret = -EPROBE_DEFER; > + goto out; > + } How does this work if a regulator is being registered in the context of a MFD registering it's children from probe()? I'm also not convinced that mixing a scoped guard into the middle of goto based cleanup is the best thing. --keHcrgmhSmEvLHlr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmoMPgcACgkQJNaLcl1U h9DNmQf/R9yoD2ik3YMMR+m4+OuAsBdIti4xjLZizAISmHweGCWAjhgdrFmeng6w MPiFpQUYNo1lQdB/33pa7UTAFZXRRQoDppiL34uVHUJNJYMzWAfAYjAvpzLpU2Rq nhzp69BKFKn8iLcoFtWiw0tp45BlrWzX/nQJkcD2qB3Jt4zbpRi7HKEu+Je2F09c xr/WwWSje0gBfzlaOkIgwH92n+nKUyGWudbmbgD/LCg2DXen+sAVIUBUu6Gal62l l4+E1qJ1jNr/1p2JSUyZADXlJFa4wf2u0ePmkRUGKMb20joDy/QyU4qdK3sj+MqJ xZkI3lL7YH2MB4oTBY/Kt+KQMQzPnw== =cfVL -----END PGP SIGNATURE----- --keHcrgmhSmEvLHlr--