From patchwork Tue Jan 17 23:21:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 9522249 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 4F48C601C3 for ; Tue, 17 Jan 2017 23:39:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43D642855A for ; Tue, 17 Jan 2017 23:39:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 389C328562; Tue, 17 Jan 2017 23:39:31 +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 C5DA52855A for ; Tue, 17 Jan 2017 23:39:30 +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 1cTdLc-0005TO-5o; Tue, 17 Jan 2017 23:39:28 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cTdLS-0004nV-C8 for linux-arm-kernel@bombadil.infradead.org; Tue, 17 Jan 2017 23:39:18 +0000 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cTd5L-0007qT-Qe for linux-arm-kernel@lists.infradead.org; Tue, 17 Jan 2017 23:22:41 +0000 Received: by mail-pg0-x243.google.com with SMTP id t6so4980699pgt.1 for ; Tue, 17 Jan 2017 15:22:16 -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=NVUUxCmHeqmLwikvwqqNkvrYCN3A4tRq87eRQFKaGlnsFawQ2BkkLZrriNFtRWU2Ax v6Ocn1JjnxNrCT9sUPq/GqqIkpoArxXSncDZsul8NFpP/0G5inAacyDPASC/lTCPBHmK UdDRVY8922m2XEj9de4umtCM5HuCLcJMqDn5taJLF+oHS/Wef0zWPZOd/xNtmmLSy4Ol HATTIhbibxO+wfTYtplvDI+U0vFflbY53r9/GbvuSTtN31NwTnP9r7Wuhzkww7fQ6IlD zIFYrU/m52V0hdnMbUlWiCw4FOeiA4J8Q3rBpY5VZHEq8gF3QbfU0+j6U1htlvokrxtt LkGg== 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=oOKqH1y6/kcOrKfZiCL1NlvnDTPdBZjfgtQV3RRvYhwCQeHr/tnT/C0BmFY6iuLwGF 1EoXHL5YOcEu3Tez9ozD93EWicUqsR/6uxcP97ou6fwkxfjFkAW0BvT5UGrUWaiMPoyX 4M+2+wJTj6LsU40/bxEklrCQHARUWfgHdm+btCqBCEY1WtJPko+H1SUGRRi7QWS2i6Zh gmIGkOYsOtSZmckDrcORy3cjznkp4B9k2/AgXWQgxoVBSjJ17ygt1H+sE2BpMUIrPmON /MripF6zRw4B+5DdWqZtdiCH+gEOe9BNR1rinfYhMIFnLTXjTxCR2WLSSn9PRkboxvAM wS6A== X-Gm-Message-State: AIkVDXImrOkGHv+numKwqQYXkQ5BQhg5+Le3H7iQaw/7hC+8q5lJgywFalDl4OZuM7XIIA== X-Received: by 10.84.129.111 with SMTP id 102mr256275plb.103.1484695335131; Tue, 17 Jan 2017 15:22:15 -0800 (PST) Received: from fainelli-desktop.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id w125sm58615705pgb.11.2017.01.17.15.22.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 15:22:14 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Subject: [PATCH net-next v4 04/10] net: dsa: Move ports assignment closer to error checking Date: Tue, 17 Jan 2017 15:21:46 -0800 Message-Id: <20170117232152.1661-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170117232152.1661-1-f.fainelli@gmail.com> References: <20170117232152.1661-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170117_232240_026942_E47C757F X-CRM114-Status: GOOD ( 13.08 ) 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 , Greg Kroah-Hartman , Russell King , open list , Gregory Clement , "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 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);