Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3545687yba; Mon, 8 Apr 2019 22:55:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEaFm3t9S/6BiTghOu4HTPebXCg205XKm49RtBeti9BNySR4kFmQMYCEZ8QPQo38XZreR8 X-Received: by 2002:a17:902:6b8a:: with SMTP id p10mr34635393plk.109.1554789308189; Mon, 08 Apr 2019 22:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554789308; cv=none; d=google.com; s=arc-20160816; b=wORqXN06k4fbIvw0IPFATLZBp6sSj14JfZ6b08okmYzj4Hh0Xmmu/0eRR1D7Irgk8W Ga393r+hMAJP+FQe0O4GjuOvDsfyWVoeGkdYtwqH82z8YQR1oXNPCFiZw0Eob/9FU39E orwX65sIWKUiLtGfn1k2EcTNuDHuVJ0jiAsfUZ1Zs/KvXZg2qi2Go5zL4GqerVcdhta5 a4Tnmgla0wJPvfO88XcLxujssTZER1H+PykRF8ef5JBx70f7M1D6WKiJAfXRq2SIjyAr a8TGUzNXbHolsLYrB6unTae06apMbs4wThu1s5k8UKq1kMDVyZLf4wz8WtpKbkO4UlrL AJuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=d9WCYkE5NNeJ1Czb1uZ/poeUMC7irU8Cakv9VZk82ss=; b=qySkJsAX9hHEkP16vkWrCJV1roPTbWAyGdmj0QhBAQKA2kGN63CVXwtDLpZsLEYhgc zjQmPY0onaEkvA82RMzBxWsoxoWqXMiaaZKW/bFvNfBRU+ajGU4/iMDI+IyDgRRxztcM h0QCFErbQWwEkw/yA279wEWoQkZWp5pMhwmfnBP9WEG068/rqL6EUV2wDRU8n+tlSh0O cQhZ1zMei1h134v9LJhVLUtKRq0dcdA5eGllQW2UuTX3+UNBf4kHxYa5G3GvxKFNMF7I zTIhVTOFjFKnZtlFSE6xZuPqF4ePeziHEucIw64BHsukBQtxY8xQ476cK+UiO1ucVtBY a+lA== 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 v67si28692922pgb.536.2019.04.08.22.54.53; Mon, 08 Apr 2019 22:55:08 -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 S1727582AbfDIFsQ (ORCPT + 99 others); Tue, 9 Apr 2019 01:48:16 -0400 Received: from out1.zte.com.cn ([202.103.147.172]:41586 "EHLO mxct.zte.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727222AbfDIFsO (ORCPT ); Tue, 9 Apr 2019 01:48:14 -0400 Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 0CB2B7FDEBDDE21AAFC2; Tue, 9 Apr 2019 13:48:12 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id x395m6pE046078; Tue, 9 Apr 2019 13:48:06 +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 2019040913482157-7975998 ; Tue, 9 Apr 2019 13:48:21 +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 2/2] net: ethernet: ti: eliminated some duplicate code. Date: Tue, 9 Apr 2019 13:48:01 +0800 Message-Id: <1554788881-22647-2-git-send-email-wen.yang99@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1554788881-22647-1-git-send-email-wen.yang99@zte.com.cn> References: <1554788881-22647-1-git-send-email-wen.yang99@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-04-09 13:48:21, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-04-09 13:48:04, Serialize complete at 2019-04-09 13:48:04 X-MAIL: mse01.zte.com.cn x395m6pE046078 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) --- 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