diff mbox

[PATCHv2] staging: octeon-ethernet: trivial: Avoid OOPS if phydev is not set

Message ID 1381773535.2049.4.camel@alpha.Speedport_W723_V_Typ_A_1_00_098
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Sebastian =?ISO-8859-1?Q?P=F6hn?= Oct. 14, 2013, 5:58 p.m. UTC
Sorry. Haven't signed off for a while now :(

I bet that this is really an issue of incorrect OF information. If I find out more I'll let you know.

@dan: The code works for some interfaces - so phydev is set correctly in some cases.

Signed-off-by: Sebastian Poehn <sebastian.poehn@googlemail.com>
---

--
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

Comments

Aaro Koskinen Oct. 14, 2013, 7:06 p.m. UTC | #1
On Mon, Oct 14, 2013 at 07:58:55PM +0200, Sebastian Pöhn wrote:
> Sorry. Haven't signed off for a while now :(
> 
> I bet that this is really an issue of incorrect OF information. If I find out more I'll let you know.
> 
> @dan: The code works for some interfaces - so phydev is set correctly in some cases.

Kernel git log is not a chat forum; please write a proper changelog,
if possible include the original oops log.

Thanks,

A.

> Signed-off-by: Sebastian Poehn <sebastian.poehn@googlemail.com>
> ---
> diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
> index 83b1030..bc8c503 100644
> --- a/drivers/staging/octeon/ethernet-mdio.c
> +++ b/drivers/staging/octeon/ethernet-mdio.c
> @@ -121,6 +121,9 @@ static void cvm_oct_adjust_link(struct net_device *dev)
>  	struct octeon_ethernet *priv = netdev_priv(dev);
>  	cvmx_helper_link_info_t link_info;
>  
> +	if (!priv->phydev)
> +		return;
> +
>  	if (priv->last_link != priv->phydev->link) {
>  		priv->last_link = priv->phydev->link;
>  		link_info.u64 = 0;
> 
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
--
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
diff mbox

Patch

diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/staging/octeon/ethernet-mdio.c
index 83b1030..bc8c503 100644
--- a/drivers/staging/octeon/ethernet-mdio.c
+++ b/drivers/staging/octeon/ethernet-mdio.c
@@ -121,6 +121,9 @@  static void cvm_oct_adjust_link(struct net_device *dev)
 	struct octeon_ethernet *priv = netdev_priv(dev);
 	cvmx_helper_link_info_t link_info;
 
+	if (!priv->phydev)
+		return;
+
 	if (priv->last_link != priv->phydev->link) {
 		priv->last_link = priv->phydev->link;
 		link_info.u64 = 0;