diff mbox series

[v3,4/4] event/octeontx2: fix build for O1 optimization

Message ID 20200511160725.1497902-4-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series [v3,1/4] ring: fix build for gcc O1 optimization | expand


Context Check Description
ci/Intel-compilation fail apply issues
ci/travis-robot success Travis build: passed
ci/checkpatch success coding style OK

Commit Message

Ferruh Yigit May 11, 2020, 4:07 p.m. UTC
Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc 7.3.0

Build error
In file included from .../drivers/event/octeontx2/ot
    In function ‘otx2_sso_xstats_get’:
    error: ‘xstats’ may be used uninitialized in this function
   xstat = &xstats[ids[i] - start_offset];

This is false positive, 'xstats_mode_count' should be preventing taking
the loop and accessing 'xstats'.
Returning in that case to silence the compiler warning.

Reported-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
 drivers/event/octeontx2/otx2_evdev_stats.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/drivers/event/octeontx2/otx2_evdev_stats.h b/drivers/event/octeontx2/otx2_evdev_stats.h
index 9d7c694ee6..74fcec8a07 100644
--- a/drivers/event/octeontx2/otx2_evdev_stats.h
+++ b/drivers/event/octeontx2/otx2_evdev_stats.h
@@ -67,7 +67,7 @@  otx2_sso_xstats_get(const struct rte_eventdev *event_dev,
 	switch (mode) {
-		break;
+		return 0;
 		if (queue_port_id >= (signed int)dev->nb_event_ports)
 			goto invalid_value;