From: Srinivas Kandagatla Date: Thu, 30 Aug 2012 05:49:58 +0000 (+0000) Subject: net:stmmac: Add check if mdiobus is registered in stmmac_mdio_unregister X-Git-Tag: omap-for-v3.7-rc1/fixes-cpufreq-signed~47^2~245 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5cf5ce92ecefcbeb3265e6f894905ab3ed5c4c2;p=pandora-kernel.git net:stmmac: Add check if mdiobus is registered in stmmac_mdio_unregister This patch adds a basic check in stmmac_mdio_unregister to see if mdio bus registeration for this driver was actually sucessfull or not. Use case here is, if BSP considers using mdio-gpio bus along with stmmac driver by passing mdio_bus_data as NULL in platform data. Call to stmmac_mdio_register with mdio_bus_data as NULL returns 0, which is a considered sucessfull call form stmmac. Then again when we unload the driver we just call stmmac_mdio_unregister, this is were the actual problem is stmmac-mdio code dont really know at this instance of calling that stmmac_mdio_register was actually successful. So Adding a check in stmmac_mdio_unregister is always safe. Without this patch stmmac driver calls stmmac_mdio_register from stmmac_release which Segfaults as mii bus was never registered at the first point. Originally the this bug was found when unloading an stmmac driver instance which uses mdio-gpio for smi access. Signed-off-by: Srinivas Kandagatla Signed-off-by: David S. Miller --- Reading git-diff-tree failed