[v2,23/34] net/ntnic: remove extra check for null

Message ID 20250205104548.1533554-24-sil-plv@napatech.com (mailing list archive)
State Accepted
Delegated to: Stephen Hemminger
Headers
Series net/ntnic: bugfixes and refactoring |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Serhii Iliushyk Feb. 5, 2025, 10:45 a.m. UTC
From: Oleksandr Kolomeiets <okl-plv@napatech.com>

pld_ptr points to mp_port_load's element,
which is initialized during driver's probe,
otherwise probe fails and xstats_get_by_id is not called.

Coverity issue: 448945
Fixes: cf6007eac498 ("net/ntnic: add xstats")

Signed-off-by: Oleksandr Kolomeiets <okl-plv@napatech.com>
---
 drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
  

Patch

diff --git a/drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c b/drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c
index 7604afe6a0..cf3271d5de 100644
--- a/drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c
+++ b/drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c
@@ -645,16 +645,8 @@  static int nthw_xstats_get_by_id(nt4ga_stat_t *p_nt4ga_stat,
 				break;
 
 			case 4:
-
 				/* Port Load stat */
-				if (pld_ptr) {
-					/* No reset */
-					values[i] = *((uint64_t *)&pld_ptr[names[i].offset]);
-
-				} else {
-					values[i] = 0;
-				}
-
+				values[i] = *((uint64_t *)&pld_ptr[names[i].offset]);
 				break;
 
 			default: