From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754601AbdKAMWE (ORCPT ); Wed, 1 Nov 2017 08:22:04 -0400 Received: from vps-vb.mhejs.net ([37.28.154.113]:57452 "EHLO vps-vb.mhejs.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754547AbdKAMWB (ORCPT ); Wed, 1 Nov 2017 08:22:01 -0400 Subject: Re: [PATCH v2] net: phy: leds: Add support for "link" trigger To: Andrew Lunn Cc: Florian Fainelli , netdev@vger.kernel.org, linux-kernel References: <52ce25a6-8d6b-039d-ca08-90595eb9ee72@maciej.szmigiero.name> <20171101121611.GD12680@lunn.ch> From: "Maciej S. Szmigiero" Message-ID: Date: Wed, 1 Nov 2017 13:21:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171101121611.GD12680@lunn.ch> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrew, On 01.11.2017 13:16, Andrew Lunn wrote: >> @@ -123,6 +153,10 @@ int phy_led_triggers_register(struct phy_device *phy) >> while (i--) >> phy_led_trigger_unregister(&phy->phy_led_triggers[i]); >> devm_kfree(&phy->mdio.dev, phy->phy_led_triggers); >> +out_unreg_link: >> + phy_led_trigger_unregister(phy->led_link_trigger); >> +out_free_link: >> + devm_kfree(&phy->mdio.dev, phy->led_link_trigger); > > Hi Maciej > > The point of the devm_ API is that you don't need to worry about > freeing the memory. The core will do it, when the driver is removed. > > I guess you are just copying the code above, which i would also say is > unnecessary. Yes, I did it the same way as the existing code did for phy->phy_led_triggers for reasons of both consistency and also to be on the safe side because maybe there is some non-obvious reason why it has to be freed explicitly (?). > Andrew Maciej