Check the return value of dev_remap_addr_index() for NULL instead of
IS_ERR(). This function only ever returns NULL on failure.

Replace the now-unused <linux/err.h> include with <errno.h>,
which is what actually provides the error codes this driver uses.

Fixes: c895ef465059 ("net: Add MT7628 ethernet driver")
Signed-off-by: David Lechner <[email protected]>
---
 drivers/net/mt7628-eth.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mt7628-eth.c b/drivers/net/mt7628-eth.c
index fc8a6bb331b..fc99320af20 100644
--- a/drivers/net/mt7628-eth.c
+++ b/drivers/net/mt7628-eth.c
@@ -15,6 +15,7 @@
 
 #include <cpu_func.h>
 #include <dm.h>
+#include <errno.h>
 #include <log.h>
 #include <malloc.h>
 #include <miiphy.h>
@@ -26,7 +27,6 @@
 #include <linux/bitfield.h>
 #include <linux/bitops.h>
 #include <linux/delay.h>
-#include <linux/err.h>
 #include <linux/printk.h>
 
 /* Ethernet frame engine register */
@@ -562,13 +562,13 @@ static int mt7628_eth_probe(struct udevice *dev)
 
        /* Save frame-engine base address for later use */
        priv->base = dev_remap_addr_index(dev, 0);
-       if (IS_ERR(priv->base))
-               return PTR_ERR(priv->base);
+       if (!priv->base)
+               return -EINVAL;
 
        /* Save switch base address for later use */
        priv->eth_sw_base = dev_remap_addr_index(dev, 1);
-       if (IS_ERR(priv->eth_sw_base))
-               return PTR_ERR(priv->eth_sw_base);
+       if (!priv->eth_sw_base)
+               return -EINVAL;
 
        /* Reset controller */
        ret = reset_get_by_name(dev, "ephy", &priv->rst_ephy);

-- 
2.43.0

Reply via email to