Skip to contentSkip to conversation

net: phy: sfp: clean up a condition

PATCH Applied Dan Carpenter 4 participants 6 messages Jun 13, 2019 – Jun 15, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: sfp: clean up a condition

The acpi_node_get_property_reference() doesn't return ACPI error codes, it just returns regular negative kernel error codes. This patch doesn't affect run time, it's just a clean up.

---
 drivers/net/phy/sfp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/sfp.c +1 -1
index a991c80e6567..8a99307c1c39 100644
@@ -1848,7 +1848,7 @@ static int sfp_probe(struct platform_device *pdev)
 		int ret;
 
 		ret = acpi_node_get_property_reference(fw, "i2c-bus", 0, &args);
-		if (ACPI_FAILURE(ret) || !is_acpi_device_node(args.fwnode)) {
+		if (ret || !is_acpi_device_node(args.fwnode)) {
 			dev_err(&pdev->dev, "missing 'i2c-bus' property\n");
 			return -ENODEV;
 		}
Signature · 1 line
2.20.1
#2 lore raw
In reply to Dan Carpenter
Quoted 14 lines · Dan Carpenter

The acpi_node_get_property_reference() doesn't return ACPI error codes, it just returns regular negative kernel error codes. This patch doesn't affect run time, it's just a clean up.

---
 drivers/net/phy/sfp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/sfp.c +0 -0
index a991c80e6567..8a99307c1c39 100644

drivers/net/phy/sfp.c static int sfp_probe(struct platform_device *pdev) · line 1853

Quoted 7 lines
drivers/net/phy/sfp.c +1 -1
@@ -1848,7 +1848,7 @@ static int sfp_probe(struct platform_device *pdev)
 		int ret;
 
 		ret = acpi_node_get_property_reference(fw, "i2c-bus", 0, &args);
-		if (ACPI_FAILURE(ret) || !is_acpi_device_node(args.fwnode)) {
+		if (ret || !is_acpi_device_node(args.fwnode)) {
 			dev_err(&pdev->dev, "missing 'i2c-bus' property\n");
 			return -ENODEV;

If "ret" is a Linux error code, should we print its value when reporting the error so we know why the failure occurred, and propagate the error code?

Quoted 5 lines
drivers/net/phy/sfp.c +0 -0
 		}
Signature · 1 line
2.20.1
Signature · 3 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
#3 lore raw
Quoted 17 lines · Russell King - ARM Linux admin
Quoted 16 lines · Dan Carpenter

The acpi_node_get_property_reference() doesn't return ACPI error codes, it just returns regular negative kernel error codes. This patch doesn't affect run time, it's just a clean up.

---
 drivers/net/phy/sfp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/sfp.c +0 -0
index a991c80e6567..8a99307c1c39 100644
@@ -1848,7 +1848,7 @@ static int sfp_probe(struct platform_device *pdev)
 		int ret;
 
Quoted 9 lines

drivers/net/phy/sfp.c static int sfp_probe(struct platform_device *pdev) · line 1853

Quoted 5 lines
drivers/net/phy/sfp.c +1 -1
 		ret = acpi_node_get_property_reference(fw, "i2c-bus", 0, &args);
-		if (ACPI_FAILURE(ret) || !is_acpi_device_node(args.fwnode)) {
+		if (ret || !is_acpi_device_node(args.fwnode)) {
 			dev_err(&pdev->dev, "missing 'i2c-bus' property\n");
 			return -ENODEV;

If "ret" is a Linux error code, should we print its value when reporting the error so we know why the failure occurred, and propagate the error code?

We can't propagate the error code because we might have failed because acpi_node_get_property_reference() succeeded but it's not a device node.

regards,
dan carpenter

#5 lore raw
Quoted 10 lines · David Miller

From: Dan Carpenter <[email protected]>
Date: Thu, 13 Jun 2019 09:51:02 +0300

Quoted 5 lines

The acpi_node_get_property_reference() doesn't return ACPI error codes, it just returns regular negative kernel error codes. This patch doesn't affect run time, it's just a clean up.

Applied to net-next.

I meant to say net-next but I made a typo. :/

regards,
dan carpenter