[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0cb4741c-7fce-973b-2b8d-7677329f440c@cogentembedded.com>
Date: Thu, 24 Nov 2016 00:55:07 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Woojung.Huh@...rochip.com, zach.brown@...com, davem@...emloft.net,
netdev@...r.kernel.org
Cc: f.fainelli@...il.com
Subject: Re: [PATCH net] phy: fix error case of phy_led_triggers_(un)register
Hello.
On 11/24/2016 12:39 AM, Woojung.Huh@...rochip.com wrote:
> From: Woojung Huh <woojung.huh@...rochip.com>
>
> When phy_init_hw() fails at phy_attach_direct();
> - phy_detach() calls phy_led_triggers_unregister() without
> previous call of phy_led_triggers_register().
> - still call phy_led_triggers_register() and cause memory leak.
>
> Signed-off-by: Woojung Huh <woojung.huh@...rochip.com>
> ---
> drivers/net/phy/phy_device.c | 6 +++---
> drivers/net/phy/phy_led_triggers.c | 3 +++
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 9e8f048..094a959 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -915,10 +915,10 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
> err = phy_init_hw(phydev);
> if (err)
> phy_detach(phydev);
> - else
> + else {
CodingStyle: all *if* branches should have {} if at least one has {}.
> phy_resume(phydev);
> -
> - phy_led_triggers_register(phydev);
> + phy_led_triggers_register(phydev);
> + }
>
> return err;
>
[...]
MBR, Sergei
Powered by blists - more mailing lists