From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756910AbdEMAkK (ORCPT ); Fri, 12 May 2017 20:40:10 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:12472 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197AbdEMAkJ (ORCPT ); Fri, 12 May 2017 20:40:09 -0400 X-IronPort-AV: E=Sophos;i="5.38,332,1491256800"; d="scan'208";a="272916685" Date: Sat, 13 May 2017 08:40:02 +0800 (SGT) From: Julia Lawall X-X-Sender: jll@hadrien To: Florian Fainelli cc: David Miller , jon.mason@broadcom.com, netdev@vger.kernel.org, andrew@lunn.ch, kbuild-all@01.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mdio: mux: fix device_node_continue.cocci warnings In-Reply-To: <872f3980-9faa-718f-3260-9e4b22946140@gmail.com> Message-ID: References: <20170512.122223.341607427763777325.davem@davemloft.net> <872f3980-9faa-718f-3260-9e4b22946140@gmail.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 12 May 2017, Florian Fainelli wrote: > On 05/12/2017 09:22 AM, David Miller wrote: > > From: Julia Lawall > > Date: Fri, 12 May 2017 22:54:23 +0800 (SGT) > > > >> Device node iterators put the previous value of the index variable, so an > >> explicit put causes a double put. > > ... > >> @@ -169,7 +169,6 @@ int mdio_mux_init(struct device *dev, > >> if (r) { > >> mdiobus_free(cb->mii_bus); > >> devm_kfree(dev, cb); > >> - of_node_put(child_bus_node); > >> } else { > > > > I think we're instead simply missing a break; statement here. > > It's kind of questionable, if we have an error initializing one of our > child MDIO bus controller (child from the perspective of the MDIO mux, > boy this is getting complicated...), should we keep on going, or should > we abort entirely and rollback what we have successfully registered? > > I don't think Julia's patch makes thing worse, in that if we had to > rollback, we would not be doing this correctly now anyway. Just to be clear, if you want the break instead, then you need to keep the put. julia > > Jon, what do you think? > -- > Florian >