[Cbe-oss-dev] [PATCH 2/3] libspe2: Add missing error checks to spe_event_handler_register
Kazunori Asayama
asayama at sm.sony.co.jp
Mon Jun 25 23:47:38 EST 2007
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);
More information about the cbe-oss-dev
mailing list