lkml.org 
[lkml]   [2019]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] net: ethernet: ti: eliminated some duplicate code.
Date
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@zte.com.cn>
Reported-by: Markus Elfring <Markus.Elfring@web.de>
Cc: Markus Elfring <Markus.Elfring@web.de>
Cc: Wingman Kwok <w-kwok2@ti.com> (maintainer:TI NETCP ETHERNET DRIVER)
Cc: Murali Karicheri <m-karicheri2@ti.com> (maintainer:TI NETCP ETHERNET DRIVER)
Cc: "David S. Miller" <davem@davemloft.net> (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
\
 
 \ /
  Last update: 2019-04-09 07:49    [W:0.055 / U:7.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site