Patch "marvell: pxa168_eth: fix call balance of pep->clk handling routines" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    marvell: pxa168_eth: fix call balance of pep->clk handling routines

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     marvell-pxa168_eth-fix-call-balance-of-pep-clk-handl.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 34a310f5d5949eb6f305cd53ee2a011a3f03cc8c
Author: Vitalii Mordan <mordan@xxxxxxxxx>
Date:   Thu Nov 21 23:06:58 2024 +0300

    marvell: pxa168_eth: fix call balance of pep->clk handling routines
    
    [ Upstream commit b032ae57d4fe2b2445e3bc190db6fcaa8c102f68 ]
    
    If the clock pep->clk was not enabled in pxa168_eth_probe,
    it should not be disabled in any path.
    
    Conversely, if it was enabled in pxa168_eth_probe, it must be disabled
    in all error paths to ensure proper cleanup.
    
    Use the devm_clk_get_enabled helper function to ensure proper call balance
    for pep->clk.
    
    Found by Linux Verification Center (linuxtesting.org) with Klever.
    
    Fixes: a49f37eed22b ("net: add Fast Ethernet driver for PXA168.")
    Signed-off-by: Vitalii Mordan <mordan@xxxxxxxxx>
    Link: https://patch.msgid.link/20241121200658.2203871-1-mordan@xxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index cf456d62677fe..1e8568a96443d 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1394,18 +1394,15 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 
 	printk(KERN_NOTICE "PXA168 10/100 Ethernet Driver\n");
 
-	clk = devm_clk_get(&pdev->dev, NULL);
+	clk = devm_clk_get_enabled(&pdev->dev, NULL);
 	if (IS_ERR(clk)) {
-		dev_err(&pdev->dev, "Fast Ethernet failed to get clock\n");
+		dev_err(&pdev->dev, "Fast Ethernet failed to get and enable clock\n");
 		return -ENODEV;
 	}
-	clk_prepare_enable(clk);
 
 	dev = alloc_etherdev(sizeof(struct pxa168_eth_private));
-	if (!dev) {
-		err = -ENOMEM;
-		goto err_clk;
-	}
+	if (!dev)
+		return -ENOMEM;
 
 	platform_set_drvdata(pdev, dev);
 	pep = netdev_priv(dev);
@@ -1523,8 +1520,6 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 	mdiobus_free(pep->smi_bus);
 err_netdev:
 	free_netdev(dev);
-err_clk:
-	clk_disable_unprepare(clk);
 	return err;
 }
 
@@ -1542,7 +1537,6 @@ static int pxa168_eth_remove(struct platform_device *pdev)
 	if (dev->phydev)
 		phy_disconnect(dev->phydev);
 
-	clk_disable_unprepare(pep->clk);
 	mdiobus_unregister(pep->smi_bus);
 	mdiobus_free(pep->smi_bus);
 	unregister_netdev(dev);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux