lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20231129122457.33413-1-liuhaoran14@163.com>
Date:   Wed, 29 Nov 2023 04:24:57 -0800
From:   Haoran Liu <liuhaoran14@....com>
To:     vkoul@...nel.org
Cc:     kishon@...nel.org, robh@...nel.org, linux-phy@...ts.infradead.org,
        linux-kernel@...r.kernel.org, Haoran Liu <liuhaoran14@....com>
Subject: [PATCH] [phy/marvell] phy-pxa-28nm-usb2: Add error handling

This patch adds error handling to the mv_usb2_phy_28nm_init
function in drivers/phy/marvell/phy-pxa-28nm-usb2.c. The
function previously did not handle the potential failure of
the clk_prepare_enable call, which could result in unexpected
behavior if clock preparation failed.

Signed-off-by: Haoran Liu <liuhaoran14@....com>
---
 drivers/phy/marvell/phy-pxa-28nm-usb2.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/marvell/phy-pxa-28nm-usb2.c b/drivers/phy/marvell/phy-pxa-28nm-usb2.c
index 64afb82cf70e..93fea4f246a2 100644
--- a/drivers/phy/marvell/phy-pxa-28nm-usb2.c
+++ b/drivers/phy/marvell/phy-pxa-28nm-usb2.c
@@ -154,7 +154,11 @@ static int mv_usb2_phy_28nm_init(struct phy *phy)
 	u32 reg;
 	int ret;
 
-	clk_prepare_enable(mv_phy->clk);
+	ret = clk_prepare_enable(mv_phy->clk);
+	if (ret) {
+		dev_err(&phy->dev, "Failed to enable clock: %d\n", ret);
+		return ret;
+	}
 
 	/* PHY_28NM_PLL_REG0 */
 	reg = readl(base + PHY_28NM_PLL_REG0) &
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ