From patchwork Tue Jan 10 20:12:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 9508487 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 7888D606E1 for ; Tue, 10 Jan 2017 20:14:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69F6B28423 for ; Tue, 10 Jan 2017 20:14:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E37328573; Tue, 10 Jan 2017 20:14:21 +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 F2A9528423 for ; Tue, 10 Jan 2017 20:14:20 +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 1cR2oG-0002wI-0U; Tue, 10 Jan 2017 20:14:20 +0000 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cR2nV-0001Zg-MT for linux-arm-kernel@lists.infradead.org; Tue, 10 Jan 2017 20:13:35 +0000 Received: by mail-pf0-x243.google.com with SMTP id f144so11401211pfa.2 for ; Tue, 10 Jan 2017 12:13:14 -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=wZM+I3uajIXFmmXOgEUpIaIfNqgGWya4VvQL4oMytms=; b=VUUc0itpVubbG7cDfwgmrz7Way8l24NcN+saqdF9VfpxeSEPY2TNrObncdywtBBHoz dppam5rpwyeccFLSiJ55mHmoB0vW8YVHdzxMkiRAvr+ryzDN6ZQo7cU26p4fYoAIp0fh aRquBcNe1IiM5pgLk1GDxk2VzwSagHXZdCSNd5JrUs56KIPeZTPzUiOUKTk6i3flOSwR izEtIueCJBdCHjSdd9bKxKzFQdmcx50SlA+hHqD8xoSjf9PzTd1GDz/WdE1BoCobukAg 4OylhhOwexYaK4stnFpMrOe5Rgw92xNdsAb6e6NzEh63V6hpiWwES8VClDEf2v0daDNT BM9A== 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=wZM+I3uajIXFmmXOgEUpIaIfNqgGWya4VvQL4oMytms=; b=Rb7IeBcoAb++ES0m9k3Y97ljJFUrf74TWVQBeWLy1ba4K6TC2D1dOuDHVp7GFugMc8 6FNnFDa0xF0aJFAGCr8Z330sVXHK1dxGyxBfxtGZMwBo2uqgX3mrp4VHnM7R1KTn9Ms6 K8DhmBKJmBIflQhF8wz5iyIcFagnTVoaKUmg3Q1Fe/1ZCkU6iDhSI+BzunndWPzBCBUa JXY8UdYRzi+UlUFBZ/n1koPOntk/tABt+cUyIJY2/a9csATZvIKwX+USUy1M6D+kVY3H /7K1jaL5LmqoAbNCkAUTog+TJmbgi0jeRa3sPnbZjwQ7fL8UeJDCqb6Vqh5ogEYpZrN7 MzHw== X-Gm-Message-State: AIkVDXJcMyybymKKlWTYJ/LzxxEdha0i2A8kFNrcmKEhRs+nD0A3klYR86i7E1wA/hCxwA== X-Received: by 10.98.0.143 with SMTP id 137mr5932214pfa.183.1484079194322; Tue, 10 Jan 2017 12:13:14 -0800 (PST) Received: from fainelli-desktop.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id e127sm7741037pfh.89.2017.01.10.12.13.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jan 2017 12:13:13 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Subject: [PATCH net-next 4/8] net: dsa: Move ports assignment closer to error checking Date: Tue, 10 Jan 2017 12:12:31 -0800 Message-Id: <20170110201235.21771-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170110201235.21771-1-f.fainelli@gmail.com> References: <20170110201235.21771-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170110_121333_806197_0E25EE6C X-CRM114-Status: GOOD ( 11.83 ) 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 , Ingo Tuchscherer , Jason Cooper , Vivien Didelot , Greg Kroah-Hartman , open list , Russell King , Stuart Yoder , Martin Schwidefsky , Gregory Clement , Philippe Reynes , "David S. Miller" , "moderated list:ARM/Marvell Dove/MV78xx0/Orion SOC support" , 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 9089b3b1d7f5..ddee540d9a83 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -600,8 +600,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; @@ -609,6 +609,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);