linux-sg2042/drivers/net/ethernet/freescale
Maciej S. Szmigiero 42ea4457ae net: fec: normalize return value of pm_runtime_get_sync() in MDIO write
If fec MDIO write method succeeds its return value comes from
call to pm_runtime_get_sync().
But pm_runtime_get_sync() can also return 1.

In case of Micrel KSZ9031 PHY this value will then
be returned along the call chain of phy_write() ->
ksz9031_extended_write() -> ksz9031_center_flp_timing() ->
ksz9031_config_init() -> phy_init_hw() -> phy_attach_direct() ->
phy_connect_direct().

Then phy_connect() will cast it into a pointer using ERR_PTR(),
which then fec_enet_mii_probe() will try to dereference
resulting in an oops.

Fix it by normalizing return value of pm_runtime_get_sync()
to be zero if positive in MDIO write method.

Fixes: 8fff755e9f ("net: fec: Ensure clocks are enabled while using mdio bus")
Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-05 22:04:06 -07:00
..
fs_enet net: fs_enet: mask interrupts for TX partial frames. 2015-08-11 12:05:34 -07:00
Kconfig net/fsl: remove dependency FSL_SOC for Gianfar 2015-06-25 02:13:04 -07:00
Makefile gianfar: Remove sysfs stubs for FIFOCFG and stashing 2014-02-18 15:03:02 -05:00
fec.h net: fec: introduce fec_ptp_stop and use in probe fail path 2015-07-26 21:51:53 -07:00
fec_main.c net: fec: normalize return value of pm_runtime_get_sync() in MDIO write 2015-09-05 22:04:06 -07:00
fec_mpc52xx.c net/fsl: constify of_device_id array 2015-03-17 15:00:21 -04:00
fec_mpc52xx.h drivers/net: fix up stale paths from driver reorg 2012-01-30 12:54:40 -05:00
fec_mpc52xx_phy.c net/fsl: constify of_device_id array 2015-03-17 15:00:21 -04:00
fec_ptp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-07-31 23:52:20 -07:00
fsl_pq_mdio.c net/fsl: constify of_device_id array 2015-03-17 15:00:21 -04:00
gianfar.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-08-21 11:44:04 -07:00
gianfar.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-07-31 23:52:20 -07:00
gianfar_ethtool.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-08-13 16:23:11 -07:00
gianfar_ptp.c ptp: gianfar: use helpers for converting ns to timespec. 2015-03-31 17:19:18 -04:00
ucc_geth.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-04-02 16:16:53 -04:00
ucc_geth.h net: remove skb recycling 2012-10-07 00:40:54 -04:00
ucc_geth_ethtool.c net: get rid of SET_ETHTOOL_OPS 2014-05-13 17:43:20 -04:00
xgmac_mdio.c net/fsl: constify of_device_id array 2015-03-17 15:00:21 -04:00