[source] net: ar8216: prevent device duplication in ar8xxx_dev_list

LEDE Commits lede-commits at lists.infradead.org
Thu Dec 1 06:47:58 PST 2016


blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/a3454d1929abb452102ad7639ade192caf98719e

commit a3454d1929abb452102ad7639ade192caf98719e
Author: Pavel Kubelun <be.dissent at gmail.com>
AuthorDate: Mon Nov 28 15:31:38 2016 +0300

    net: ar8216: prevent device duplication in ar8xxx_dev_list
    
    Import from https://chromium.googlesource.com/chromiumos/third_party/kernel/+/fd7b89dd464a4afffa04ff2e17c771dfe95668cf%5E%21/#F0
    Signed-off-by: Pavel Kubelun <be.dissent at gmail.com>
    
    CHROMIUM: drivers: ar8216: prevent device duplication in ar8xxx_dev_list
    
    If probe is called twice, once for PHY0 and a second time for PHY4,
    the same switch device will be added twice to ar8xxx_dev_list, while
    supposedly this list should have one element per hardware switch present
    in the system.
    
    While no negative impact have been observed, it does happen if a
    platform instanciates these two PHYs from device-tree, as an example.
    
    Change-Id: Iddcbdf7d4adacb0af01975b73f8e56b4582e894e
    Signed-off-by: Mathieu Olivari <mathieu at codeaurora.org>
    Reviewed-on: https://chromium-review.googlesource.com/234790
    Reviewed-by: Matthias Kaehlcke <mka at chromium.org>
    Reviewed-by: Toshi Kikuchi <toshik at chromium.org>
    Tested-by: Toshi Kikuchi <toshik at chromium.org>
---
 target/linux/generic/files/drivers/net/phy/ar8216.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c b/target/linux/generic/files/drivers/net/phy/ar8216.c
index d575043..6c670dd 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -2171,6 +2171,8 @@ ar8xxx_phy_probe(struct phy_device *phydev)
 		swdev->devname, swdev->name, priv->chip_rev,
 		dev_name(&priv->mii_bus->dev));
 
+	list_add(&priv->list, &ar8xxx_dev_list);
+
 found:
 	priv->use_count++;
 
@@ -2199,8 +2201,6 @@ found:
 
 	phydev->priv = priv;
 
-	list_add(&priv->list, &ar8xxx_dev_list);
-
 	mutex_unlock(&ar8xxx_dev_list_lock);
 
 	return 0;



More information about the lede-commits mailing list