Skip to contentSkip to conversation

phy: qcom-qmp: fix return value check in qcom_qmp_phy_create()

PATCH Applied Wei Yongjun 3 participants 3 messages Apr 25, 2017 – May 17, 2017 Generic PHY framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: qcom-qmp: fix return value check in qcom_qmp_phy_create()

From: Wei Yongjun <[email protected]>

In case of error, the function of_iomap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
---
 drivers/phy/phy-qcom-qmp.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/phy/phy-qcom-qmp.c +6 -6
index 727e23b..a25c29d 100644
@@ -983,16 +983,16 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id)
 	 * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
 	 */
 	qphy->tx = of_iomap(np, 0);
-	if (IS_ERR(qphy->tx))
-		return PTR_ERR(qphy->tx);
+	if (!qphy->tx)
+		return -ENOMEM;
 
 	qphy->rx = of_iomap(np, 1);
-	if (IS_ERR(qphy->rx))
-		return PTR_ERR(qphy->rx);
+	if (!qphy->rx)
+		return -ENOMEM;
 
 	qphy->pcs = of_iomap(np, 2);
-	if (IS_ERR(qphy->pcs))
-		return PTR_ERR(qphy->pcs);
+	if (!qphy->pcs)
+		return -ENOMEM;
 
 	/*
 	 * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

In case of error, the function of_iomap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")
Quoted 32 lines
---
  drivers/phy/phy-qcom-qmp.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
drivers/phy/phy-qcom-qmp.c +6 -6
index 727e23b..a25c29d 100644
@@ -983,16 +983,16 @@ int qcom_qmp_phy_create(struct device *dev, struct device_node *np, int id)
  	 * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
  	 */
  	qphy->tx = of_iomap(np, 0);
-	if (IS_ERR(qphy->tx))
-		return PTR_ERR(qphy->tx);
+	if (!qphy->tx)
+		return -ENOMEM;
 
  	qphy->rx = of_iomap(np, 1);
-	if (IS_ERR(qphy->rx))
-		return PTR_ERR(qphy->rx);
+	if (!qphy->rx)
+		return -ENOMEM;
 
  	qphy->pcs = of_iomap(np, 2);
-	if (IS_ERR(qphy->pcs))
-		return PTR_ERR(qphy->pcs);
+	if (!qphy->pcs)
+		return -ENOMEM;
 
  	/*
  	 * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw
Quoted 5 lines · Vivek Gautam
Quoted 2 lines · Wei Yongjun

From: Wei Yongjun <[email protected]>

Quoted 8 lines
Quoted 6 lines

In case of error, the function of_iomap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes e78f3d15e115 ("phy: qcom-qmp: new qmp phy driver for qcom-chipsets")

merged, thanks.

-Kishon

Quoted 32 lines
Quoted 31 lines
---
  drivers/phy/phy-qcom-qmp.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
drivers/phy/phy-qcom-qmp.c +6 -6
index 727e23b..a25c29d 100644
@@ -983,16 +983,16 @@ int qcom_qmp_phy_create(struct device *dev, struct
 device_node *np, int id)
       * Resources are indexed as: tx -> 0; rx -> 1; pcs -> 2.
       */
      qphy->tx = of_iomap(np, 0);
-    if (IS_ERR(qphy->tx))
-        return PTR_ERR(qphy->tx);
+    if (!qphy->tx)
+        return -ENOMEM;
        qphy->rx = of_iomap(np, 1);
-    if (IS_ERR(qphy->rx))
-        return PTR_ERR(qphy->rx);
+    if (!qphy->rx)
+        return -ENOMEM;
        qphy->pcs = of_iomap(np, 2);
-    if (IS_ERR(qphy->pcs))
-        return PTR_ERR(qphy->pcs);
+    if (!qphy->pcs)
+        return -ENOMEM;
        /*
       * Get PHY's Pipe clock, if any. USB3 and PCIe are PIPE3