[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1554788881-22647-2-git-send-email-wen.yang99@zte.com.cn>
Date: Tue, 9 Apr 2019 13:48:01 +0800
From: Wen Yang <wen.yang99@....com.cn>
To: linux-kernel@...r.kernel.org
Cc: wang.yi59@....com.cn, Wen Yang <wen.yang99@....com.cn>,
Markus Elfring <Markus.Elfring@....de>,
Wingman Kwok <w-kwok2@...com>,
Murali Karicheri <m-karicheri2@...com>,
"David S. Miller" <davem@...emloft.net>,
netdev@...r.kernel.org (open list:TI NETCP ETHERNET DRIVER)
Subject: [PATCH 2/2] net: ethernet: ti: eliminated some duplicate code.
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 <wen.yang99@....com.cn>
Reported-by: Markus Elfring <Markus.Elfring@....de>
Cc: Markus Elfring <Markus.Elfring@....de>
Cc: Wingman Kwok <w-kwok2@...com> (maintainer:TI NETCP ETHERNET DRIVER)
Cc: Murali Karicheri <m-karicheri2@...com> (maintainer:TI NETCP ETHERNET DRIVER)
Cc: "David S. Miller" <davem@...emloft.net> (odd fixer:NETWORKING DRIVERS)
Cc: netdev@...r.kernel.org (open list:TI NETCP ETHERNET DRIVER)
Cc: linux-kernel@...r.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
Powered by blists - more mailing lists