From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751313AbdAQOen (ORCPT ); Tue, 17 Jan 2017 09:34:43 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:52506 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750941AbdAQOeK (ORCPT ); Tue, 17 Jan 2017 09:34:10 -0500 Subject: Re: [PATCH] stmmac: add missing of_node_put To: Julia Lawall , Giuseppe Cavallaro References: <1484652201-20048-1-git-send-email-Julia.Lawall@lip6.fr> CC: , , From: Alexandre Torgue Message-ID: <3b6da79c-93aa-b3e4-a36d-15325873711d@st.com> Date: Tue, 17 Jan 2017 14:54:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1484652201-20048-1-git-send-email-Julia.Lawall@lip6.fr> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG3NODE3.st.com (10.75.127.9) To SFHDAG3NODE2.st.com (10.75.127.8) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-17_08:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On 01/17/2017 12:23 PM, Julia Lawall wrote: > The function stmmac_dt_phy provides several possibilities for initializing > plat->mdio_node, all of which have the effect of increasing the reference > count of the assigned value. This field is not updated elsewhere, so the > value is live until the end of the lifetime of plat (devm_allocated), just > after the end of stmmac_remove_config_dt. Thus, add an of_node_put on > plat->mdio_node in stmmac_remove_config_dt. It is possible that the field > mdio_node is never initialized, but of_node_put is NULL-safe, so it is also > safe to call of_node_put in that case. > > Signed-off-by: Julia Lawall > > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > index 4daa8a3..460f94f 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c > @@ -409,6 +409,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev, > if (of_phy_is_fixed_link(np)) > of_phy_deregister_fixed_link(np); > of_node_put(plat->phy_node); > + of_node_put(plat->mdio_node); > } > #else > struct plat_stmmacenet_data * > Acked-by: Alexandre TORGUE Thanks Alex