diff mbox

validation: check return code from odp_queue_lock_count()

Message ID 1446114294-13085-1-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit 225ced87250c65429e9bc7f0c5f0c5f9257cdb66
Headers show

Commit Message

Maxim Uvarov Oct. 29, 2015, 10:24 a.m. UTC
odp_queue_lock_count() return int not uint32_t where -1
is assigned for error.
Bug: https://bugs.linaro.org/show_bug.cgi?id=1867

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 test/validation/scheduler/scheduler.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

Comments

Bill Fischofer Oct. 29, 2015, 10:46 a.m. UTC | #1
Note that my Bug fix patch for Bug 1824 also touches this module.  Not sure
if there are merge conflicts between these two.

On Thu, Oct 29, 2015 at 5:24 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> odp_queue_lock_count() return int not uint32_t where -1

> is assigned for error.

> Bug: https://bugs.linaro.org/show_bug.cgi?id=1867

>

> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

>


Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>



> ---

>  test/validation/scheduler/scheduler.c | 22 +++++++++++++++-------

>  1 file changed, 15 insertions(+), 7 deletions(-)

>

> diff --git a/test/validation/scheduler/scheduler.c

> b/test/validation/scheduler/scheduler.c

> index 89c1099..e8f5844 100644

> --- a/test/validation/scheduler/scheduler.c

> +++ b/test/validation/scheduler/scheduler.c

> @@ -417,8 +417,11 @@ static void *schedule_common_(void *arg)

>                                 continue;

>

>                         if (sync == ODP_SCHED_SYNC_ORDERED) {

> -                               uint32_t ndx;

> -                               uint32_t ndx_max =

> odp_queue_lock_count(from);

> +                               int ndx;

> +                               int ndx_max;

> +

> +                               ndx_max = odp_queue_lock_count(from);

> +                               CU_ASSERT_FATAL(ndx_max >= 0);

>

>                                 qctx = odp_queue_context(from);

>                                 bctx = odp_buffer_addr(

> @@ -442,8 +445,11 @@ static void *schedule_common_(void *arg)

>                                 continue;

>                         num = 1;

>                         if (sync == ODP_SCHED_SYNC_ORDERED) {

> -                               uint32_t ndx;

> -                               uint32_t ndx_max =

> odp_queue_lock_count(from);

> +                               int ndx;

> +                               int ndx_max;

> +

> +                               ndx_max = odp_queue_lock_count(from);

> +                               CU_ASSERT_FATAL(ndx_max >= 0);

>

>                                 qctx = odp_queue_context(from);

>                                 bctx = odp_buffer_addr(buf);

> @@ -580,9 +586,11 @@ static void reset_queues(thread_args_t *args)

>                         for (k = 0; k < args->num_bufs; k++) {

>                                 queue_context *qctx =

>                                         odp_queue_context(queue);

> -                               uint32_t ndx;

> -                               uint32_t ndx_max =

> -                                       odp_queue_lock_count(queue);

> +                               int ndx;

> +                               int ndx_max;

> +

> +                               ndx_max = odp_queue_lock_count(queue);

> +                               CU_ASSERT_FATAL(ndx_max >= 0);

>                                 qctx->sequence = 0;

>                                 for (ndx = 0; ndx < ndx_max; ndx++)

>                                         qctx->lock_sequence[ndx] = 0;

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
diff mbox

Patch

diff --git a/test/validation/scheduler/scheduler.c b/test/validation/scheduler/scheduler.c
index 89c1099..e8f5844 100644
--- a/test/validation/scheduler/scheduler.c
+++ b/test/validation/scheduler/scheduler.c
@@ -417,8 +417,11 @@  static void *schedule_common_(void *arg)
 				continue;
 
 			if (sync == ODP_SCHED_SYNC_ORDERED) {
-				uint32_t ndx;
-				uint32_t ndx_max = odp_queue_lock_count(from);
+				int ndx;
+				int ndx_max;
+
+				ndx_max = odp_queue_lock_count(from);
+				CU_ASSERT_FATAL(ndx_max >= 0);
 
 				qctx = odp_queue_context(from);
 				bctx = odp_buffer_addr(
@@ -442,8 +445,11 @@  static void *schedule_common_(void *arg)
 				continue;
 			num = 1;
 			if (sync == ODP_SCHED_SYNC_ORDERED) {
-				uint32_t ndx;
-				uint32_t ndx_max = odp_queue_lock_count(from);
+				int ndx;
+				int ndx_max;
+
+				ndx_max = odp_queue_lock_count(from);
+				CU_ASSERT_FATAL(ndx_max >= 0);
 
 				qctx = odp_queue_context(from);
 				bctx = odp_buffer_addr(buf);
@@ -580,9 +586,11 @@  static void reset_queues(thread_args_t *args)
 			for (k = 0; k < args->num_bufs; k++) {
 				queue_context *qctx =
 					odp_queue_context(queue);
-				uint32_t ndx;
-				uint32_t ndx_max =
-					odp_queue_lock_count(queue);
+				int ndx;
+				int ndx_max;
+
+				ndx_max = odp_queue_lock_count(queue);
+				CU_ASSERT_FATAL(ndx_max >= 0);
 				qctx->sequence = 0;
 				for (ndx = 0; ndx < ndx_max; ndx++)
 					qctx->lock_sequence[ndx] = 0;