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 D38EE81728; Mon, 6 Jan 2025 15:56:17 +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=1736178977; cv=none; b=KUHW2sVuDtfN03CFDgD1knacSnhFCa/0vpe6Z9PByxUATGRxwPqWiV6bgQ2pnr3JiNeCdTh2K4XHpUaXo0NqRFqE5cnotJSGpAwzWMX14lVBjhpanJwZcdoYs0VqQnihDmbSGiJEBG47mRxMyh8/G9au8k/xT60CVTU6J4UrzKk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736178977; c=relaxed/simple; bh=e2ClKiupTS0yVbM491ZI5T9iAMe0wRDsiG8XwP6UTjw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mRfiBncJbfAwj+XhMc3p9rMLqci9XyoDKpmDoyrUz/a28zIQlxqRTeUgrr0KmYj8j4uaaED4WDn/O1mRXdAiBm9Ymn1keI6kErQYrJt6ZBGO0n3/TI+rNGPxNn9Kt0DYGpZFQN3P5CKS7VHc7ePKU+VjAKqVHD91XIbYZ7JzPwQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=L6H9uIy4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="L6H9uIy4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BC37C4CED2; Mon, 6 Jan 2025 15:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1736178977; bh=e2ClKiupTS0yVbM491ZI5T9iAMe0wRDsiG8XwP6UTjw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L6H9uIy4recmcLNF68/7qB9CXk9Ot4Su+CRz5wr2Y9BnKpDpQgmFWzoozVBAM78fm hnUvt6jxdbn6y88qz05AdSCPeM11AuK4XuIDVSpDDGsGTrN4YY1qKWU7U7g+20sVtj pWqDFUUgUtTCL8Mv/MW0uQsKyPPukI1kxk17kW3E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Vitalii Mordan , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 137/168] eth: bcmsysport: fix call balance of priv->clk handling routines Date: Mon, 6 Jan 2025 16:17:25 +0100 Message-ID: <20250106151143.611411852@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250106151138.451846855@linuxfoundation.org> References: <20250106151138.451846855@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vitalii Mordan [ Upstream commit b255ef45fcc2141c1bf98456796abb956d843a27 ] Check the return value of clk_prepare_enable to ensure that priv->clk has been successfully enabled. If priv->clk was not enabled during bcm_sysport_probe, bcm_sysport_resume, or bcm_sysport_open, it must not be disabled in any subsequent execution paths. Fixes: 31bc72d97656 ("net: systemport: fetch and use clock resources") Signed-off-by: Vitalii Mordan Reviewed-by: Florian Fainelli Link: https://patch.msgid.link/20241227123007.2333397-1-mordan@ispras.ru Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/bcmsysport.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 8962bd6349d4..fa140c5175a6 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -1956,7 +1956,11 @@ static int bcm_sysport_open(struct net_device *dev) unsigned int i; int ret; - clk_prepare_enable(priv->clk); + ret = clk_prepare_enable(priv->clk); + if (ret) { + netdev_err(dev, "could not enable priv clock\n"); + return ret; + } /* Reset UniMAC */ umac_reset(priv); @@ -2618,7 +2622,11 @@ static int bcm_sysport_probe(struct platform_device *pdev) goto err_deregister_notifier; } - clk_prepare_enable(priv->clk); + ret = clk_prepare_enable(priv->clk); + if (ret) { + dev_err(&pdev->dev, "could not enable priv clock\n"); + goto err_deregister_netdev; + } priv->rev = topctrl_readl(priv, REV_CNTL) & REV_MASK; dev_info(&pdev->dev, @@ -2632,6 +2640,8 @@ static int bcm_sysport_probe(struct platform_device *pdev) return 0; +err_deregister_netdev: + unregister_netdev(dev); err_deregister_notifier: unregister_netdevice_notifier(&priv->netdev_notifier); err_deregister_fixed_link: @@ -2803,7 +2813,12 @@ static int __maybe_unused bcm_sysport_resume(struct device *d) if (!netif_running(dev)) return 0; - clk_prepare_enable(priv->clk); + ret = clk_prepare_enable(priv->clk); + if (ret) { + netdev_err(dev, "could not enable priv clock\n"); + return ret; + } + if (priv->wolopts) clk_disable_unprepare(priv->wol_clk); -- 2.39.5