[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFcVECJQH15y78YPurq_m2bDigQ6EzSCZHZMROHRFe-rJKw88g@mail.gmail.com>
Date: Tue, 19 Nov 2019 18:28:12 +0530
From: Harini Katakam <harinik@...inx.com>
To: YueHaibing <yuehaibing@...wei.com>
Cc: Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
David Miller <davem@...emloft.net>, mail@...id-bauer.net,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Michal Simek <michal.simek@...inx.com>
Subject: Re: [PATCH] mdio_bus: Fix PTR_ERR applied after initialization to constant
On Mon, Nov 11, 2019 at 12:53 PM YueHaibing <yuehaibing@...wei.com> wrote:
>
> Fix coccinelle warning:
>
> ./drivers/net/phy/mdio_bus.c:67:5-12: ERROR: PTR_ERR applied after initialization to constant on line 62
> ./drivers/net/phy/mdio_bus.c:68:5-12: ERROR: PTR_ERR applied after initialization to constant on line 62
>
> Fix this by using IS_ERR before PTR_ERR
>
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Fixes: 71dd6c0dff51 ("net: phy: add support for reset-controller")
> Signed-off-by: YueHaibing <yuehaibing@...wei.com>
> ---
> drivers/net/phy/mdio_bus.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 2e29ab8..3587656 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -64,11 +64,12 @@ static int mdiobus_register_reset(struct mdio_device *mdiodev)
> if (mdiodev->dev.of_node)
> reset = devm_reset_control_get_exclusive(&mdiodev->dev,
> "phy");
> - if (PTR_ERR(reset) == -ENOENT ||
> - PTR_ERR(reset) == -ENOTSUPP)
> - reset = NULL;
> - else if (IS_ERR(reset))
> - return PTR_ERR(reset);
> + if (IS_ERR(reset)) {
> + if (PTR_ERR(reset) == -ENOENT || PTR_ERR(reset) == -ENOSYS)
> + reset = NULL;
> + else
> + return PTR_ERR(reset);
> + }
>
> mdiodev->reset_ctrl = reset;
>
Adding Michal Simek to add some test comments.
> --
> 2.7.4
>
>
Powered by blists - more mailing lists