]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: at803x: fix probe error if copper page is selected
authorMichael Walle <michael@walle.cc>
Tue, 20 Apr 2021 10:29:29 +0000 (12:29 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 21 Apr 2021 00:08:28 +0000 (17:08 -0700)
commitaa9cf65cac82b189d0064e04d8695165f57d6ff9
tree8c4673d9e9e85af8737cf2ef75944f3d0aebd95e
parentb5c7c0f709a35cca84638410ed290dece8ea9382
net: phy: at803x: fix probe error if copper page is selected

The commit a627ec63d05b ("net: phy: at803x: select correct page on
config init") selects the copper page during probe. This fails if the
copper page was already selected. In this case, the value of the copper
page (which is 1) is propagated through phy_restore_page() and is
finally returned for at803x_probe(). Fix it, by just using the
at803x_page_write() directly.

Also in case of an error, the regulator is not disabled and leads to a
WARN_ON() when the probe fails. This couldn't happen before, because
at803x_parse_dt() was the last call in at803x_probe(). It is hard to
see, that the parse_dt() actually enables the regulator. Thus move the
regulator_enable() to the probe function and undo it in case of an
error.

Fixes: a627ec63d05b ("net: phy: at803x: select correct page on config init")
Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: David Bauer <mail@david-bauer.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/at803x.c