summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/phy/phy-core.c')
-rw-r--r--drivers/net/phy/phy-core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index 21daaa9a2b..b12f54ed38 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
#include <common.h>
#include <linux/phy.h>
@@ -26,6 +27,11 @@ static int phy_read_page(struct phy_device *phydev)
{
struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
+ if (!phydrv->read_page) {
+ dev_warn_once(&phydev->dev, "read_page callback not available, PHY driver not loaded?\n");
+ return -EOPNOTSUPP;
+ }
+
return phydrv->read_page(phydev);
}
@@ -33,6 +39,11 @@ static int phy_write_page(struct phy_device *phydev, int page)
{
struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver);
+ if (!phydrv->write_page) {
+ dev_warn_once(&phydev->dev, "write_page callback not available, PHY driver not loaded?\n");
+ return -EOPNOTSUPP;
+ }
+
return phydrv->write_page(phydev, page);
}