Skip to contentSkip to conversation

Staging: usb: Use PTR_ERR_OR_ZERO instead of if(IS_ERR(...)) + PTR_ERR.

PATCH Superseded Sandhya Bankar 2 participants 3 messages Feb 27, 2016 – Feb 28, 2016 USB

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Staging: usb: Use PTR_ERR_OR_ZERO instead of if(IS_ERR(...)) + PTR_ERR.

Use PTR_ERR_OR_ZERO instead of if(IS_ERR(...)) + PTR_ERR.

---
 drivers/usb/phy/phy-qcom-8x16-usb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/usb/phy/phy-qcom-8x16-usb.c +1 -4
index 579587d..dc97abe 100644
@@ -291,10 +291,7 @@ static int phy_8x16_read_devicetree(struct phy_8x16 *qphy)
 
 	qphy->switch_gpio = devm_gpiod_get_optional(dev, "switch",
 						   GPIOD_OUT_LOW);
-	if (IS_ERR(qphy->switch_gpio))
-		return PTR_ERR(qphy->switch_gpio);
-
-	return 0;
+	PTR_ERR_OR_ZERO(qphy->switch_gpio);
 }
 
 static int phy_8x16_reboot_notify(struct notifier_block *this,
Signature · 1 line
1.8.3.4
#1 lore raw
Quoted 12 lines · Sandhya Bankar

Use PTR_ERR_OR_ZERO instead of if(IS_ERR(...)) + PTR_ERR.

---
 drivers/usb/phy/phy-qcom-8x16-usb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/usb/phy/phy-qcom-8x16-usb.c +0 -0
index 579587d..dc97abe 100644

drivers/usb/phy/phy-qcom-8x16-usb.c static int phy_8x16_read_devicetree(struct phy_8x16 *qphy) · line 294

Quoted 8 lines
drivers/usb/phy/phy-qcom-8x16-usb.c +1 -4
@@ -291,10 +291,7 @@ static int phy_8x16_read_devicetree(struct phy_8x16 *qphy)
 
 	qphy->switch_gpio = devm_gpiod_get_optional(dev, "switch",
 						   GPIOD_OUT_LOW);
-	if (IS_ERR(qphy->switch_gpio))
-		return PTR_ERR(qphy->switch_gpio);
-
-	return 0;
+	PTR_ERR_OR_ZERO(qphy->switch_gpio);

You still need the return.

julia

#2 lore raw
In reply to Sandhya Bankar

Please ignore this patchset. I was not in driver/staging.

Quoted 30 lines · sandhya bankar

Use PTR_ERR_OR_ZERO instead of if(IS_ERR(...)) + PTR_ERR.

---
drivers/usb/phy/phy-qcom-8x16-usb.c | 5 +---- t

 1 file changed, 1 insertion(+), 4 deletions(-) 
drivers/usb/phy/phy-qcom-8x16-usb.c +1 -4
index 579587d..dc97abe 100644 
@@ -291,10 +291,7 @@ static int phy_8x16_read_devicetree(struct phy_8x16 
 *qphy) 
 
         qphy->switch_gpio = devm_gpiod_get_optional(dev, "switch", 
                                                    GPIOD_OUT_LOW); 
-        if (IS_ERR(qphy->switch_gpio)) 
-                return PTR_ERR(qphy->switch_gpio); 
- 
-        return 0; 
+        PTR_ERR_OR_ZERO(qphy->switch_gpio); 
 } 
 

static int phy_8x16_reboot_notify(struct notifier_block *this,

Signature · 1 line
1.8.3.4