From nobody Mon Jun 8 08:35:32 2026 Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (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 5DEEB246788 for ; Sun, 31 May 2026 05:19:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780204751; cv=none; b=hiPSjaai5+MIRXC/03Nta+1EDFpobz/B4Zv4AsYbaVR1VJ6XyjtXlFtfi49nAYvRncEzfjdtr2C/Oex9HXJlkJHPk2GWY5Hnp6r8GY19/eaBRQ6zrMeT53EninX3Ji/FnaJlC69RbqC6aBnkUeaqKZqBw9Ypo9B5k2CRsjIP2Xg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780204751; c=relaxed/simple; bh=5YP5jApvSsQhS1zAl7EYN1vNdsOaW+ijBhhUGqpj3Fg=; h=Date:To:From:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=Kw0FptmnzNWkJpHChqeJDKVughMsRO0wJ2GjdU/GyiqMGdZ9LqDw7eIlcRGnm7r8odomIau3sUAIabVIzb3f6a9Tmn5wGzI+zkbZxFM85gE4zEs0Ouzc5Oh39hWfXEIZqiRzack1b0kLoMAxSt3r+3bt+osbyJp/D79iS/BGg5E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me; spf=pass smtp.mailfrom=pm.me; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b=kZJbJqcl; arc=none smtp.client-ip=185.70.43.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pm.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="kZJbJqcl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1780204748; x=1780463948; bh=5YP5jApvSsQhS1zAl7EYN1vNdsOaW+ijBhhUGqpj3Fg=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=kZJbJqclaqPgmL5KkXHHQMNarWibg5woRKJkwJr+1rRWi9m8G4CEY599+2lrn6G7f jlQVCO0wHtLPmEIJ9RAOyUvi99BoGwemmW4bCa5dFJE688nueIObBdhHvjE1pw4XBD 4wUVuN45s+4MokFyY2y50cBBjV6G402DlWqSLIhLAl7wjw/E54TU8BgHJq9WsXGhdL x2lMCgkgEsXMoLjoeVPz3xWTRshG9SwNCLUKh1bzfMsJYMsj//EvRy+vIlHNVLneaE 61X6rxqxK4rVpHJMuxv9YSMoQskZgLjIYF6XXpXrUtqqYUC02kobvBfuxMc4lFxD29 O/jd7gY9fMYqA== Date: Sun, 31 May 2026 05:18:55 +0000 To: netdev@vger.kernel.org From: =?utf-8?Q?Gustavo_Kenji_Mendon=C3=A7a_Kaneko?= Cc: theo.lebrun@bootlin.com, conor.dooley@microchip.com, davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org, =?utf-8?Q?Gustavo_Kenji_Mendon=C3=A7a_Kaneko?= Subject: [PATCH] net: macb: fix ignored return value of clk_prepare_enable() in runtime resume Message-ID: <20260531051841.55311-1-kaneko.dev@pm.me> Feedback-ID: 165279626:user:proton X-Pm-Message-ID: 4b989aed9c341e1b41f02b9284338125aeed274e Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" macb_runtime_resume() calls clk_prepare_enable() five times without checking the return value. If any clock fails to enable, the driver silently continues with potentially unclocked hardware, which can cause undefined behavior or system instability on resume from runtime suspend. The existing macb_clks_disable() already uses clk_bulk_disable_unprepare() for the symmetric disable path. Align the enable path by using clk_bulk_prepare_enable(), which atomically enables all clocks and automatically rolls back any successfully enabled clocks on failure. Signed-off-by: Gustavo Kenji Mendon=C3=A7a Kaneko --- drivers/net/ethernet/cadence/macb_main.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/etherne= t/cadence/macb_main.c index a12aa21244e8..85bd4ff0e4e6 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -6185,16 +6185,19 @@ static int __maybe_unused macb_runtime_resume(struc= t device *dev) { struct net_device *netdev =3D dev_get_drvdata(dev); struct macb *bp =3D netdev_priv(netdev); + struct clk_bulk_data clks[] =3D { + { .clk =3D bp->pclk }, + { .clk =3D bp->hclk }, + { .clk =3D bp->tx_clk }, + { .clk =3D bp->rx_clk }, + { .clk =3D bp->tsu_clk }, + }; =20 - if (!(device_may_wakeup(dev))) { - clk_prepare_enable(bp->pclk); - clk_prepare_enable(bp->hclk); - clk_prepare_enable(bp->tx_clk); - clk_prepare_enable(bp->rx_clk); - clk_prepare_enable(bp->tsu_clk); - } else if (!(bp->caps & MACB_CAPS_NEED_TSUCLK)) { - clk_prepare_enable(bp->tsu_clk); - } + if (!(device_may_wakeup(dev))) + return clk_bulk_prepare_enable(ARRAY_SIZE(clks), clks); + + if (!(bp->caps & MACB_CAPS_NEED_TSUCLK)) + return clk_prepare_enable(bp->tsu_clk); =20 return 0; } --=20 2.54.0