From 1294b5152c0ad90ad25ca7e1ad5f862370649738 Mon Sep 17 00:00:00 2001
From: Anjan Chanda <anjan.chanda@iopsys.eu>
Date: Thu, 25 Feb 2021 13:24:29 +0100
Subject: [PATCH] libethernet: bcm: do not overwrite stats available through
 proc

---
 bcm/bcm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bcm/bcm.c b/bcm/bcm.c
index 59f00c9..65a54de 100644
--- a/bcm/bcm.c
+++ b/bcm/bcm.c
@@ -286,6 +286,8 @@ int bcm_eth_get_stats(const char *ifname, struct eth_stats *s)
 
 	/* get from proc first */
 	ret_proc = bcm_eth_get_stats_from_proc(ifname, s);
+	if (!ret_proc)
+		return 0;
 
 	memset(&data, 0, sizeof(struct ethswctl_data));
 	ret = bcm_eth_get_unit_port(ifname, &unit, &port);
-- 
GitLab