]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: fix a bug in get_phy_c45_ids
authorShaohui Xie <Shaohui.Xie@freescale.com>
Tue, 3 Nov 2015 04:27:33 +0000 (12:27 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 Nov 2015 04:45:20 +0000 (23:45 -0500)
commita03e9bc17d50d76235c3662c2f77cc5e9b4bc282
tree1a584383b2a07a88e8ba3081e30aed14b2e408c5
parent21e0cd13f019823bc9387be58ad5c0ce391d1c62
net: phy: fix a bug in get_phy_c45_ids

When probing devices-in-package for a c45 phy, device zero is the last
device to probe, however, if driver reads 0 from device zero,
c45_ids->devices_in_package is set to '0', the loop condition of probing
will be matched again, see codes below:

for (i = 1;i < num_ids && c45_ids->devices_in_package == 0;i++)

driver will run in a dead loop.

This patch restructures the bug and confusing loop, it provides a helper
function get_phy_c45_devs_in_pkg which to read devices-in-package registers
of a MMD, and rewrites the loop with using the helper function.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy_device.c