From nobody Mon Jun 8 06:36:25 2026 Received: from mail-106118.protonmail.ch (mail-106118.protonmail.ch [79.135.106.118]) (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 89CA732E151 for ; Mon, 1 Jun 2026 06:19:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.135.106.118 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780294778; cv=none; b=NYudppSmx2dfbxPlwwjUXYP+SSOUeJf2kqSJxILPZc+EjavEqV8rEn8zEkgvmhSXpYUf4U1YKlFDe5TS4EF3eIefm26InXYtwmNbfC1Vskmo1DvJneqiJYohYKRxxyje9CgXlQuDGrCtYzwPf6kROmsVV3fJ+30P2wFBpNLn3Lw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780294778; c=relaxed/simple; bh=OJf6Jrho7l0BHrvLQhxK/07RMk9wGzkK/7GjX7mRplU=; h=Date:To:From:Cc:Subject:Message-ID:MIME-Version:Content-Type; b=mW5JIEb63lNivHLv6qvMRtGqPUDpSQYnCqxb2OcnfUbocqE3qef4U0IOXzk8vQsL0j/ToAwwmHTQJ0/G5As//JnIQXoZZ9RRvXH1swNUHPNBIAU6JoM0YFRhMdvnSdV4sDwffFNmTPo5AY4m3bZu9Npqqc3zQ31u0bEWLzpmngs= 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=YRsng8fA; arc=none smtp.client-ip=79.135.106.118 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="YRsng8fA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1780294768; x=1780553968; bh=UGqugeIGGNHkt1QY9TpB8W4urY02c7aWKCiTn3mvj4w=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=YRsng8fAe2LVbNICY1whBeKKsNR98Ml6KAuuOQkDcoBCT+8A0Cca+D8MgBnV5bbMX BNwuPKhllL2zmfuyjhHFKcaEorT+jb0MW6LmM7o6zRztEzS6f7uNkTlY2BI9wTPKxb gDPMhcouhnw2OaxAeOqBMjlWXTPDn8za/EQRJcs0brgAPZ1L2h9VJjJ8u+heB3BIqf UuM19IFdBeKlTMGd/Mct+HcwTJA5Gt3TPK/rUt3onNXTMgVBMiYY7rObgz3jfJMdGk wMLRZb21GJ0oNg86VYJqR+04rheLfGhwB5pppy7Y7sc5tOwLAcmY2Dld/NxEn/v8qH RMj/KO8bmQn8g== Date: Mon, 01 Jun 2026 06:19:22 +0000 To: theo.lebrun@bootlin.com, conor.dooley@microchip.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com From: =?utf-8?Q?Gustavo_Kenji_Mendon=C3=A7a_Kaneko?= Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?Q?Gustavo_Kenji_Mendon=C3=A7a_Kaneko?= Subject: [PATCH v2] net: macb: check return value of clk_prepare_enable() in runtime resume Message-ID: <20260601061906.127174-1-kaneko.dev@pm.me> Feedback-ID: 165279626:user:proton X-Pm-Message-ID: dad26ad65a0240fbed8162ade397c178e0e62905 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 but discards the return value each time. clk_prepare_enable() is marked __must_check, and if a clock fails to enable the driver would silently continue with potentially unclocked hardware. The symmetric disable path, macb_clks_disable(), already uses clk_bulk_disable_unprepare(). Convert the enable path to the matching clk_bulk_prepare_enable(), which enables the clocks as a group and, on failure, unwinds the ones it already enabled before returning the error. This was found by code review, not by an observed failure, and I do not have macb hardware to test on; it is a robustness fix that propagates the clk_prepare_enable() error instead of discarding it. Signed-off-by: Gustavo Kenji Mendon=C3=A7a Kaneko Reviewed-by: Alexander Lobakin --- v2: - Reword the commit message: drop the misleading "atomically" wording (there is no locking involved) and describe this as a robustness fix found by code review rather than a fix for an observed bug. - Cc the networking maintainers that were missing from v1. 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