Patchwork sis190: use an adequate phy list entry as a fallback

login
register
mail settings
Submitter fran├žois romieu
Date June 17, 2009, 9:43 p.m.
Message ID <20090617214311.GB27064@electric-eye.fr.zoreil.com>
Download mbox | patch
Permalink /patch/28814/
State Accepted
Delegated to: David Miller
Headers show

Comments

fran├žois romieu - June 17, 2009, 9:43 p.m.
When sis190 driver is trying to get default phy, if it doesn't find home
or lan phy, it falls back to the first phy in the phy list but list_entry()
points to a bogus entry. list_first_entry() should be used instead.

Signed-off-by: Arnaud Patard <apatard@mandriva.com>
Acked-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
 drivers/net/sis190.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
David Miller - June 18, 2009, 1:54 a.m.
From: Francois Romieu <romieu@fr.zoreil.com>
Date: Wed, 17 Jun 2009 23:43:11 +0200

> When sis190 driver is trying to get default phy, if it doesn't find home
> or lan phy, it falls back to the first phy in the phy list but list_entry()
> points to a bogus entry. list_first_entry() should be used instead.
> 
> Signed-off-by: Arnaud Patard <apatard@mandriva.com>
> Acked-off-by: Francois Romieu <romieu@fr.zoreil.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index e224766..1f040e8 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -1281,7 +1281,7 @@  static u16 sis190_default_phy(struct net_device *dev)
 		else if (phy_lan)
 			phy_default = phy_lan;
 		else
-			phy_default = list_entry(&tp->first_phy,
+			phy_default = list_first_entry(&tp->first_phy,
 						 struct sis190_phy, list);
 	}