patch "net: stmicro: handle clk_prepare() failure during init" added to char-misc-linus
Subsystems (5)
This is a note to let you know that I've just added the patch titled
net: stmicro: handle clk_prepare() failure during init
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 0c32a96d000f260b5ebfabb4145a86ae1cd71847 Mon Sep 17 00:00:00 2001
From: Anirudh Rayabharam <[email protected]>
Date: Mon, 3 May 2021 13:56:48 +0200
Subject: net: stmicro: handle clk_prepare() failure during init
In case clk_prepare() fails, capture and propagate the error code up the stack. If regulator_enable() was called earlier, properly unwind it by calling regulator_disable().
--- drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +5 -3
@@ -30,7 +30,7 @@ struct sunxi_priv_data {static int sun7i_gmac_init (struct platform_device *pdev,void *priv) {struct sunxi_priv_data *gmac = priv; -int ret; +int ret =0 ;if (gmac->regulator) { ret =regulator_enable (gmac->regulator);
@@ -50,10 +50,12 @@ static int sun7i_gmac_init(struct platform_device *pdev, void *priv) gmac->clk_enabled =1 ; }else {clk_set_rate (gmac->tx_clk,SUN7I_GMAC_MII_RATE ); -clk_prepare (gmac->tx_clk); + ret =clk_prepare (gmac->tx_clk); +if (ret && gmac->regulator) +regulator_disable (gmac->regulator); } -return 0 ; +return ret; }static void sun7i_gmac_exit (struct platform_device *pdev,void *priv)
Signature · 1 line
2.31.1