app/compress-perf: fix floating point exception
authorAdam Dybkowski <adamx.dybkowski@intel.com>
Tue, 6 Aug 2019 10:37:38 +0000 (12:37 +0200)
committerAkhil Goyal <akhil.goyal@nxp.com>
Wed, 9 Oct 2019 09:50:12 +0000 (11:50 +0200)
This patch fixes the floating point exception that happened
when the number of cores to be used during the benchmark
was zero. After the fix such situation is detected, the error
message is printed and the benchmark application exits.

Fixes: 424dd6c8c1a8 ("app/compress-perf: add weak functions for multicore test")
Cc: stable@dpdk.org
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
app/test-compress-perf/main.c

index e7ac412..6f095b5 100644 (file)
@@ -127,9 +127,13 @@ comp_perf_initialize_compressdev(struct comp_test_data *test_data,
         * if there are more available than cores.
         */
        if (enabled_cdev_count > nb_lcores) {
+               if (nb_lcores == 0) {
+                       RTE_LOG(ERR, USER1, "Cannot run with 0 cores! Increase the number of cores\n");
+                       return -EINVAL;
+               }
                enabled_cdev_count = nb_lcores;
                RTE_LOG(INFO, USER1,
-                       " There's more available devices than cores!"
+                       "There's more available devices than cores!"
                        " The number of devices has been aligned to %d cores\n",
                        nb_lcores);
        }