From patchwork Thu Jan 12 03:41:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 9512003 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1E11D60710 for ; Thu, 12 Jan 2017 03:42:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F2862864B for ; Thu, 12 Jan 2017 03:42:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 039DF2865F; Thu, 12 Jan 2017 03:42:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B01072864B for ; Thu, 12 Jan 2017 03:42:37 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cRWHc-0007gz-Dj; Thu, 12 Jan 2017 03:42:36 +0000 Received: from mail-oi0-x243.google.com ([2607:f8b0:4003:c06::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cRWHD-00073P-QH for linux-arm-kernel@lists.infradead.org; Thu, 12 Jan 2017 03:42:13 +0000 Received: by mail-oi0-x243.google.com with SMTP id 3so1142775oih.1 for ; Wed, 11 Jan 2017 19:41:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c5/lfrwd1CJ3U67XJMm5O8qgRV+OwOTxcfPV74I77ZQ=; b=kW+ubruf1Gk6uTBT5/G/AXtTSLoojb0TVvWFb1KbhCMEf4ZbMITIi+2s76tJkWAWzB iz9/a5AwVCSmtRo3gc3BHPyw6WTE9BZFoo6yG/wbJvEEBx7AfVgLcbe53rUnfv+DhyUv mFyHGZ9/I+Zkg8kmOW0BIhf5yn9c3I4pLp7IL/hKsBV/vFVjxwr1NT4RGUN334nbmpHW caTJLrV/tgHMcjm7ilXrFO7TCSRt7JFXg4JFoaMbjlMPtC+WpqdA6QfMxz7gMYAX+0Qw bsIhdNOGoEfn0ts7gkhD3os0f81NAyxYC7sAkMkrCHRUDbwtghuIPDRYBOP81xt2LsOJ sSRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c5/lfrwd1CJ3U67XJMm5O8qgRV+OwOTxcfPV74I77ZQ=; b=fo+8niX/BZDAmxcz8z/xcrKBDemanHHecR/JRlhGeZ9JqL5vi2oLm8wlKGlKl1GiL5 gQ/jk2GUbfVD9FSdWQK6mP6kebxZDO1VTHQI+CHKQhlqy2wlSbZUU47kmxN30gAweaxx 2R2HPuMbCxtxU2KH0COkZwcGPWMC5r3MIBBEEMVTzsTUHXLU+pSUa5t653aExB6pafiJ h5XKij2xyxQuofrUjcOXyrTUI+cTz+fNqoNDi8Wia6rtvACz8/1cDeMecQvfPNtsBiwi SvrpgLqDVZAnLuBPi+bPqJevUXMR6jYjR4jJJmSDB8jN+Vzec7Bgb5pzp9VG6hkp0Ajq uwhQ== X-Gm-Message-State: AIkVDXIfN7pYdlviHsdxjpFE80MZLpOLiX5DgkFBDOZ0Ie6zbu49Om1duAJEeDRBggIfhg== X-Received: by 10.157.19.88 with SMTP id q24mr2473681otq.41.1484192515087; Wed, 11 Jan 2017 19:41:55 -0800 (PST) Received: from fainelli-laptop.lan ([2001:470:d:73f:b16f:f382:be58:4136]) by smtp.gmail.com with ESMTPSA id f7sm3585543otb.34.2017.01.11.19.41.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 19:41:54 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Subject: [PATCH net-next v2 04/10] net: dsa: Move ports assignment closer to error checking Date: Wed, 11 Jan 2017 19:41:15 -0800 Message-Id: <20170112034121.27697-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170112034121.27697-1-f.fainelli@gmail.com> References: <20170112034121.27697-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170111_194211_900310_691AEBE8 X-CRM114-Status: GOOD ( 11.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , Florian Fainelli , Jason Cooper , Vivien Didelot , gregkh@linuxfoundation.org, Russell King , open list , Gregory Clement , "David S. Miller" , "moderated list:ARM SUB-ARCHITECTURES" , Sebastian Hesselbarth MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Move the assignment of ports in _dsa_register_switch() closer to where it is checked, no functional change. Re-order declarations to be preserve the inverted christmas tree style. Signed-off-by: Florian Fainelli --- net/dsa/dsa2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 04ab62251fe3..cd91070b5467 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -587,8 +587,8 @@ static struct device_node *dsa_get_ports(struct dsa_switch *ds, static int _dsa_register_switch(struct dsa_switch *ds, struct device *dev) { struct device_node *np = dev->of_node; - struct device_node *ports = dsa_get_ports(ds, np); struct dsa_switch_tree *dst; + struct device_node *ports; u32 tree, index; int i, err; @@ -596,6 +596,7 @@ static int _dsa_register_switch(struct dsa_switch *ds, struct device *dev) if (err) return err; + ports = dsa_get_ports(ds, np); if (IS_ERR(ports)) return PTR_ERR(ports);