From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752353AbbJFHUh (ORCPT ); Tue, 6 Oct 2015 03:20:37 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:36568 "EHLO mail-wi0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751909AbbJFHUe (ORCPT ); Tue, 6 Oct 2015 03:20:34 -0400 Subject: Re: [PATCH v2 5/5] net: dsa: exit probe if no switch were found To: Florian Fainelli , "David S. Miller" , Guenter Roeck , vivien.didelot@savoirfairelinux.com, Andrew Lunn , Fabian Frederick , Pavel Nakonechny , Joe Perches , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, nbd@openwrt.org, sergei.shtylyov@cogentembedded.com References: <560FE587.80307@baylibre.com> <56103A3B.4020102@gmail.com> From: Neil Armstrong Organization: Baylibre Message-ID: <56137640.8060108@baylibre.com> Date: Tue, 6 Oct 2015 08:20:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <56103A3B.4020102@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/03/2015 09:27 PM, Florian Fainelli wrote: > Le 03/10/2015 07:26, Neil Armstrong a écrit : >> If no switch were found in dsa_setup_dst, return -ENODEV and >> exit the dsa_probe cleanly. >> >> Tested-by: Andrew Lunn >> Tested-by: Florian Fainelli >> Signed-off-by: Neil Armstrong >> --- > > [snip] > >> static int dsa_probe(struct platform_device *pdev) >> @@ -926,9 +937,9 @@ static int dsa_probe(struct platform_device *pdev) >> >> platform_set_drvdata(pdev, dst); >> >> - dsa_setup_dst(dst, dev, &pdev->dev, pd); >> - >> - return 0; >> + ret = dsa_setup_dst(dst, dev, &pdev->dev, pd); >> + if (!ret) >> + return 0; > > That logic is a little weird, I would just go with something like this: > > ret = dsa_setup_dst(ds, dev, &pdev->dev, pd); > if (ret) > goto out; > > return 0; > Yes you are right, the goto out is needed to clean up the of_probe resources. I will send a v3 with this fixed. Neil