From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: [PATCH] staging: octeon-ethernet: trivial: Avoid OOPS if phydev is not set Date: Mon, 14 Oct 2013 22:16:49 +0300 Message-ID: <20131014191541.GA11797@mwanda> References: <1381690794.2848.11.camel@alpha.Speedport_W723_V_Typ_A_1_00_098> <20131013212810.GA15167@kroah.com> <20131014101051.GH6192@mwanda> <20131014183906.GA4260@blackmetal.musicnaut.iki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: support@caviumnetworks.com, David Daney , Greg KH , driverdev-devel@linuxdriverproject.org, Sebastian =?iso-8859-1?Q?P=F6hn?= , netdev@vger.kernel.org To: Aaro Koskinen Return-path: Content-Disposition: inline In-Reply-To: <20131014183906.GA4260@blackmetal.musicnaut.iki.fi> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: driverdev-devel-bounces@linuxdriverproject.org List-Id: netdev.vger.kernel.org On Mon, Oct 14, 2013 at 09:39:06PM +0300, Aaro Koskinen wrote: > Hi, > = > On Mon, Oct 14, 2013 at 01:10:51PM +0300, Dan Carpenter wrote: > > On Sun, Oct 13, 2013 at 02:28:10PM -0700, Greg KH wrote: > > > On Sun, Oct 13, 2013 at 08:59:54PM +0200, Sebastian P=F6hn wrote: > > > > A zero pointer deref on priv->phydev->link was causing oops on our = systems. > > > > Might be related to improper configuration but we should fail grace= fully here ;-) > > > > = > > > > Signed-off-by: Sebastian Poehn > > > > = > > > > --- > > > > = > > > > diff --git a/drivers/staging/octeon/ethernet-mdio.c b/drivers/stagi= ng/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_devi= ce *dev) > > > > struct octeon_ethernet *priv =3D netdev_priv(dev); > > > > cvmx_helper_link_info_t link_info; > > > > = > > > > + if(!priv->phydev) > > > > + return ; > > > = > > > Please always run your patches through the scripts/checkpatch.pl tool= so > > > that maintainers don't have to point out the obvious coding syle erro= rs > > > by hand each time :) > > = > > Also it's whitespace damaged and doesn't apply. > > = > > > = > > > Care to try again? > > > = > > > Also, how was phydev NULL? What was causing that? > > = > > To me it looks like phydev is always NULL. > = > It's initialized in cvm_oct_phy_setup_device(): > = > priv->phydev =3D of_phy_connect(dev, phy_node, cvm_oct_adjust_link, 0, ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ Sorry I should have explained better. We use cvm_oct_adjust_link() to initialize priv->phydev but cvm_oct_adjust_link() depends on priv->phydev. It seems like we would hit the NULL dereference every time. Weird huh? regards, dan carpenter