From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933005AbdELWwa (ORCPT ); Fri, 12 May 2017 18:52:30 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34632 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751811AbdELWw2 (ORCPT ); Fri, 12 May 2017 18:52:28 -0400 Subject: Re: [PATCH] mdio: mux: fix device_node_continue.cocci warnings To: David Miller , julia.lawall@lip6.fr, jon.mason@broadcom.com References: <20170512.122223.341607427763777325.davem@davemloft.net> Cc: netdev@vger.kernel.org, jon.mason@broadcom.com, andrew@lunn.ch, kbuild-all@01.org, linux-kernel@vger.kernel.org From: Florian Fainelli Message-ID: <872f3980-9faa-718f-3260-9e4b22946140@gmail.com> Date: Fri, 12 May 2017 15:52:25 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170512.122223.341607427763777325.davem@davemloft.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Jon, what do you think? -- Florian