[net] net: phy: sfp: clean up a condition
diff mbox series

Message ID 20190613065102.GA16334@mwanda
State Accepted
Delegated to: David Miller
Headers show
Series
  • [net] net: phy: sfp: clean up a condition
Related show

Commit Message

Dan Carpenter June 13, 2019, 6:51 a.m. UTC
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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/phy/sfp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ruslan Babayev June 13, 2019, 5:54 p.m. UTC | #1
Dan Carpenter writes:

> 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.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---

Reviewed-by: Ruslan Babayev <ruslan@babayev.com>
Russell King - ARM Linux admin June 13, 2019, 6 p.m. UTC | #2
On Thu, Jun 13, 2019 at 09:51:02AM +0300, Dan Carpenter wrote:
> 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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/net/phy/sfp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> index a991c80e6567..8a99307c1c39 100644
> --- a/drivers/net/phy/sfp.c
> +++ b/drivers/net/phy/sfp.c
> @@ -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?

>  		}
> -- 
> 2.20.1
> 
>
Dan Carpenter June 14, 2019, 4:43 a.m. UTC | #3
On Thu, Jun 13, 2019 at 07:00:16PM +0100, Russell King - ARM Linux admin wrote:
> On Thu, Jun 13, 2019 at 09:51:02AM +0300, Dan Carpenter wrote:
> > 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.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> >  drivers/net/phy/sfp.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> > index a991c80e6567..8a99307c1c39 100644
> > --- a/drivers/net/phy/sfp.c
> > +++ b/drivers/net/phy/sfp.c
> > @@ -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?

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
David Miller June 15, 2019, 2:21 a.m. UTC | #4
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Thu, 13 Jun 2019 09:51:02 +0300

> 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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied to net-next.
Dan Carpenter June 15, 2019, 7:09 a.m. UTC | #5
On Fri, Jun 14, 2019 at 07:21:48PM -0700, David Miller wrote:
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Date: Thu, 13 Jun 2019 09:51:02 +0300
> 
> > 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.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Applied to net-next.

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

regards,
dan carpenter

Patch
diff mbox series

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index a991c80e6567..8a99307c1c39 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -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;
 		}