diff mbox

linux-generic: linux: Check if odp_init_local() succeeded

Message ID 1406130904-13512-1-git-send-email-taras.kondratiuk@linaro.org
State Accepted
Commit 108d078a751449cb674783e6ea783fcce97a6586
Headers show

Commit Message

Taras Kondratiuk July 23, 2014, 3:55 p.m. UTC
If odp_init_local() failed the thread should not run further.

Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
---
 platform/linux-generic/odp_linux.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Maxim Uvarov July 28, 2014, 7:26 a.m. UTC | #1
Merged, thanks,
Maxim.

On 07/23/2014 07:55 PM, Taras Kondratiuk wrote:
> If odp_init_local() failed the thread should not run further.
>
> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org>
> ---
>   platform/linux-generic/odp_linux.c |    7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/platform/linux-generic/odp_linux.c b/platform/linux-generic/odp_linux.c
> index 10fdf44..6e2b448 100644
> --- a/platform/linux-generic/odp_linux.c
> +++ b/platform/linux-generic/odp_linux.c
> @@ -19,6 +19,7 @@
>   #include <odp_thread.h>
>   #include <odp_init.h>
>   #include <odp_system_info.h>
> +#include <odp_debug.h>
>   
>   
>   typedef struct {
> @@ -34,7 +35,11 @@ static void *odp_run_start_routine(void *arg)
>   	odp_start_args_t *start_args = arg;
>   
>   	/* ODP thread local init */
> -	odp_init_local(start_args->thr_id);
> +	if (odp_init_local(start_args->thr_id)) {
> +		ODP_ERR("Local init failed for thread: %d\n",
> +			start_args->thr_id);
> +		return NULL;
> +	}
>   
>   	return start_args->start_routine(start_args->arg);
>   }
diff mbox

Patch

diff --git a/platform/linux-generic/odp_linux.c b/platform/linux-generic/odp_linux.c
index 10fdf44..6e2b448 100644
--- a/platform/linux-generic/odp_linux.c
+++ b/platform/linux-generic/odp_linux.c
@@ -19,6 +19,7 @@ 
 #include <odp_thread.h>
 #include <odp_init.h>
 #include <odp_system_info.h>
+#include <odp_debug.h>
 
 
 typedef struct {
@@ -34,7 +35,11 @@  static void *odp_run_start_routine(void *arg)
 	odp_start_args_t *start_args = arg;
 
 	/* ODP thread local init */
-	odp_init_local(start_args->thr_id);
+	if (odp_init_local(start_args->thr_id)) {
+		ODP_ERR("Local init failed for thread: %d\n",
+			start_args->thr_id);
+		return NULL;
+	}
 
 	return start_args->start_routine(start_args->arg);
 }