[v2,03/10] app/eventdev: fix maybe-uninitialized warnings for LTO build

Message ID 20190917075754.8310-4-amo@semihalf.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Add an option to use LTO for DPDK build |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Andrzej Ostruszka Sept. 17, 2019, 7:57 a.m. UTC
  During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
---
 app/test-eventdev/test_perf_common.c     | 2 +-
 app/test-eventdev/test_pipeline_common.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
  

Comments

Jerin Jacob Oct. 12, 2019, 1:52 p.m. UTC | #1
On Tue, Sep 17, 2019 at 1:28 PM Andrzej Ostruszka <amo@semihalf.com> wrote:
>
> During LTO build compiler reports some 'false positive' warnings about
> variables being possibly used uninitialized.  This patch silences these
> warnings.
>
> Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>

# Please fix check-git-log.sh errors.
Missing 'Fixes' tag:
        app/eventdev: fix maybe-uninitialized warnings for LTO build

# Please add the compiler 'false positive' warning output in git commit.

# Since it is a slow path change, IMO there is no harm in
introducing this change to make compiler happy.

With the above fix:
Reviewed-by: Jerin Jacob <jerinj@marvell.com>


> ---
>  app/test-eventdev/test_perf_common.c     | 2 +-
>  app/test-eventdev/test_pipeline_common.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
> index aa925a7ef..a974685cb 100644
> --- a/app/test-eventdev/test_perf_common.c
> +++ b/app/test-eventdev/test_perf_common.c
> @@ -439,7 +439,7 @@ perf_event_timer_adapter_setup(struct test_perf *t)
>
>                 if (!(adapter_info.caps &
>                                 RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT)) {
> -                       uint32_t service_id;
> +                       uint32_t service_id = -1U;
>
>                         rte_event_timer_adapter_service_id_get(wl,
>                                         &service_id);
> diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
> index 16c49b860..813d0cf44 100644
> --- a/app/test-eventdev/test_pipeline_common.c
> +++ b/app/test-eventdev/test_pipeline_common.c
> @@ -306,7 +306,7 @@ pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride,
>                 }
>
>                 if (!(cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)) {
> -                       uint32_t service_id;
> +                       uint32_t service_id = -1U;
>
>                         rte_event_eth_rx_adapter_service_id_get(prod,
>                                         &service_id);
> @@ -358,7 +358,7 @@ pipeline_event_tx_adapter_setup(struct evt_options *opt,
>                 }
>
>                 if (!(cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)) {
> -                       uint32_t service_id;
> +                       uint32_t service_id = -1U;
>
>                         rte_event_eth_tx_adapter_service_id_get(consm,
>                                         &service_id);
> --
> 2.17.1
>
  

Patch

diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c
index aa925a7ef..a974685cb 100644
--- a/app/test-eventdev/test_perf_common.c
+++ b/app/test-eventdev/test_perf_common.c
@@ -439,7 +439,7 @@  perf_event_timer_adapter_setup(struct test_perf *t)
 
 		if (!(adapter_info.caps &
 				RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT)) {
-			uint32_t service_id;
+			uint32_t service_id = -1U;
 
 			rte_event_timer_adapter_service_id_get(wl,
 					&service_id);
diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c
index 16c49b860..813d0cf44 100644
--- a/app/test-eventdev/test_pipeline_common.c
+++ b/app/test-eventdev/test_pipeline_common.c
@@ -306,7 +306,7 @@  pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride,
 		}
 
 		if (!(cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)) {
-			uint32_t service_id;
+			uint32_t service_id = -1U;
 
 			rte_event_eth_rx_adapter_service_id_get(prod,
 					&service_id);
@@ -358,7 +358,7 @@  pipeline_event_tx_adapter_setup(struct evt_options *opt,
 		}
 
 		if (!(cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)) {
-			uint32_t service_id;
+			uint32_t service_id = -1U;
 
 			rte_event_eth_tx_adapter_service_id_get(consm,
 					&service_id);