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

Add <errno.h>, since this is the first error code used directly
in this file.

Fixes: 968f512e6c9f ("phy: qcom: Add SNPS femto v2 USB HS phy")
Signed-off-by: David Lechner <[email protected]>
---
 drivers/phy/qcom/phy-qcom-snps-femto-v2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/qcom/phy-qcom-snps-femto-v2.c 
b/drivers/phy/qcom/phy-qcom-snps-femto-v2.c
index e782de07ebc..bf1f16e4a22 100644
--- a/drivers/phy/qcom/phy-qcom-snps-femto-v2.c
+++ b/drivers/phy/qcom/phy-qcom-snps-femto-v2.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <errno.h>
 #include <generic-phy.h>
 #include <malloc.h>
 #include <reset.h>
@@ -165,8 +166,8 @@ static int qcom_snps_hsphy_phy_probe(struct udevice *dev)
        int ret;
 
        priv->base = dev_read_addr_ptr(dev);
-       if (IS_ERR(priv->base))
-               return PTR_ERR(priv->base);
+       if (!priv->base)
+               return -EINVAL;
 
        ret = reset_get_bulk(dev, &priv->resets);
        if (ret < 0) {

-- 
2.43.0

Reply via email to