[Cbe-oss-dev] [PATCH 2/3] libspe2: Add missing error checks to spe_event_handler_register

Gerhard Stenzel gerhard.stenzel at de.ibm.com
Tue Jun 26 20:10:53 EST 2007


Looks good to me, please go ahead and apply

> This patch adds missing error checks to spe_event_handler_register in
> libspe2.
>
> Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
>
> ---
>  speevent/spe_event.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> Index: b/speevent/spe_event.c
> ===================================================================
> --- a/speevent/spe_event.c   2007-06-22 20:27:25.000000000 +0900
> +++ b/speevent/spe_event.c   2007-06-22 20:27:41.000000000 +0900
> @@ -42,6 +42,9 @@
>  #define __SPE_EVENT_CONTEXT_PRIV_SET(spe, evctx) \
>    ( (spe)->event_private = (evctx) )
>
> +#define __SPE_EVENTS_ENABLED(spe) \
> +  ((spe)->base_private->flags & SPE_EVENTS_ENABLE)
> +
>
>  void _event_spe_context_lock(spe_context_ptr_t spe)
>  {
> @@ -166,6 +169,10 @@ int _event_spe_event_handler_register(sp
>      errno = EINVAL;
>      return -1;
>    }
> +  if (!__SPE_EVENTS_ENABLED(event->spe)) {
> +    errno = ENOTSUP;
> +    return -1;
> +  }
>
>    epfd = __SPE_EPOLL_FD_GET(evhandler);
>    evctx = __SPE_EVENT_CONTEXT_PRIV_GET(event->spe);
> @@ -278,6 +285,10 @@ int _event_spe_event_handler_deregister(
>      errno = EINVAL;
>      return -1;
>    }
> +  if (!__SPE_EVENTS_ENABLED(event->spe)) {
> +    errno = ENOTSUP;
> +    return -1;
> +  }
>
>    epfd = __SPE_EPOLL_FD_GET(evhandler);
>    evctx = __SPE_EVENT_CONTEXT_PRIV_GET(event->spe);
> _______________________________________________
> cbe-oss-dev mailing list
> cbe-oss-dev at ozlabs.org
> https://ozlabs.org/mailman/listinfo/cbe-oss-dev


Best regards,

Gerhard Stenzel, Linux on Cell Development, LTC
-----------------------------------------------------------------------------------------------------------------------------------

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter | Geschäftsführung: Herbert
Kircher
Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht Stuttgart,
HRB 243294




More information about the cbe-oss-dev mailing list