Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4444111yba; Tue, 9 Apr 2019 19:55:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDHKCyeBsqQdUzORQ1/oqnKW9k3RsEK0qaYwdrCx0zZoDHONeETQHFdSzr5QjWOZY7RomA X-Received: by 2002:a17:902:b210:: with SMTP id t16mr36102047plr.84.1554864951617; Tue, 09 Apr 2019 19:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554864951; cv=none; d=google.com; s=arc-20160816; b=Zp/m7w0GjyhiIFh3SU9DFKhct8jpHqxyvV7banxLDmHjRqa7yG73IFHuksCL/lLxjH 4k+1wPvMhDK4IlmwSOyscEslCkxDUIiAMmzRlvqhI7ZQNS2X2PkbLU/15jrUBpBb0YDf CYYdyx2E2KyOOMt6jnt2EiYtZwUFvDsMgDzl0r/ol/jwrXybDKYU7CIGYqFSYF7sbJkY 4nFn7OmhwR3h9ebjYACbL46HbmkRE7MehbPsSutqR1dn+xHGxxu2Kdbi3jeUsg6YNioh Lpapz5u2p5RRB9Nq5unj8u7gfNMtH/U7PPJ+O8OfFrguOG4nu/zhOP1mnuBH6+vOo8hJ gg8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=c3gfXwqYXCY1018WjTIzIziKqaEskDMknBmLQafQlKs=; b=u7mCisleq7QaErD9jErgsC4NxZlGJCCooKHituLdybx5JY2QD75QqVcwMDPR98AXX5 eCcIv3CigWp94GB9WXqTWjrAAz6R3mjAcjIJxIotFBFJX0tYaF4uh9TCVDHJNqY76vnG U9qmo5hsETsu3Fph/iHe6t6v5nVAgne80N5sSIrY/JoYihI7e5y5y/kqUysaH3gBhMIa Cay/m7+d3m6FAy8h1rqpOdb2vJPULIEzOlL6cN/qDQeKAM0KUwmqpADeoRzBWD8H0lbn +DrBT+u8M+bKENdo/Ot2vpGFYiP9wFAxXe1YrwDRObyQxMqTCuaBYcBGoJkT/ZM2fhWs DQaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f12si24205459pgo.388.2019.04.09.19.55.35; Tue, 09 Apr 2019 19:55:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726830AbfDJCy6 (ORCPT + 99 others); Tue, 9 Apr 2019 22:54:58 -0400 Received: from out1.zte.com.cn ([202.103.147.172]:59014 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726577AbfDJCy6 (ORCPT ); Tue, 9 Apr 2019 22:54:58 -0400 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 3F1C65D0CF1939456793; Wed, 10 Apr 2019 10:54:55 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x3A2snF4005614; Wed, 10 Apr 2019 10:54:49 +0800 (GMT-8) (envelope-from wen.yang99@zte.com.cn) Received: from fox-host8.localdomain ([10.74.120.8]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019041010551108-8110307 ; Wed, 10 Apr 2019 10:55:11 +0800 From: Wen Yang To: linux-kernel@vger.kernel.org Cc: wang.yi59@zte.com.cn, Wen Yang , Markus Elfring , Wingman Kwok , Murali Karicheri , "David S. Miller" , netdev@vger.kernel.org (open list:TI NETCP ETHERNET DRIVER) Subject: [PATCH v2] net: ethernet: ti: eliminate a bit of duplicate code in gbe_probe() Date: Wed, 10 Apr 2019 10:55:35 +0800 Message-Id: <1554864935-8299-1-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-04-10 10:55:11, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-04-10 10:54:43, Serialize complete at 2019-04-10 10:54:43 X-MAIL: mse01.zte.com.cn x3A2snF4005614 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Put the code that obtains device_node and the code that uses it tightly together to remove duplicate resource cleanup statements between them. Signed-off-by: Wen Yang Reported-by: Markus Elfring Cc: Markus Elfring Cc: Wingman Kwok (maintainer:TI NETCP ETHERNET DRIVER) Cc: Murali Karicheri (maintainer:TI NETCP ETHERNET DRIVER) Cc: "David S. Miller" (odd fixer:NETWORKING DRIVERS) Cc: netdev@vger.kernel.org (open list:TI NETCP ETHERNET DRIVER) Cc: linux-kernel@vger.kernel.org (open list) --- v2: Massaged changelog a bit drivers/net/ethernet/ti/netcp_ethss.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c index 0a920c5..748116a 100644 --- a/drivers/net/ethernet/ti/netcp_ethss.c +++ b/drivers/net/ethernet/ti/netcp_ethss.c @@ -3651,22 +3651,18 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev, if (ret) return ret; - interfaces = of_get_child_by_name(node, "interfaces"); - if (!interfaces) - dev_err(dev, "could not find interfaces\n"); - ret = netcp_txpipe_init(&gbe_dev->tx_pipe, netcp_device, gbe_dev->dma_chan_name, gbe_dev->tx_queue_id); - if (ret) { - of_node_put(interfaces); + if (ret) return ret; - } ret = netcp_txpipe_open(&gbe_dev->tx_pipe); - if (ret) { - of_node_put(interfaces); + if (ret) return ret; - } + + interfaces = of_get_child_by_name(node, "interfaces"); + if (!interfaces) + dev_err(dev, "could not find interfaces\n"); /* Create network interfaces */ INIT_LIST_HEAD(&gbe_dev->gbe_intf_head); -- 2.9.5