event/octeontx2: fix build for O1 optimization
authorFerruh Yigit <ferruh.yigit@intel.com>
Mon, 11 May 2020 16:07:25 +0000 (17:07 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 11 May 2020 19:09:20 +0000 (21:09 +0200)
commitea153cc853049c6f935693e48d2866782370a3fe
treeb34babf6170b33dc43a8d7b40264ae855ac84088
parent5f267cb01b41def2af37b8fa56828e75ae91add0
event/octeontx2: fix build for O1 optimization

Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc 7.3.0

Build error
In file included from .../drivers/event/octeontx2/ot
x2_evdev.c:15:0:
.../drivers/event/octeontx2/otx2_evdev_stats.h:
    In function ‘otx2_sso_xstats_get’:
.../drivers/event/octeontx2/otx2_evdev_stats.h:124:9:
    error: ‘xstats’ may be used uninitialized in this function
           [-Werror=maybe-uninitialized]
   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