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

Kazunori Asayama asayama at sm.sony.co.jp
Mon Jun 25 23:46:39 EST 2007


This patch adds missing error checks to spe_signal_write in libspe2.

Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>

---
 spebase/mbox.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: b/spebase/mbox.c
===================================================================
--- a/spebase/mbox.c	2007-05-24 19:33:24.000000000 +0900
+++ b/spebase/mbox.c	2007-06-22 20:29:31.000000000 +0900
@@ -319,6 +319,9 @@ int _base_spe_signal_write(spe_context_p
 			spe_sig_notify_2_area_t *sig = spectx->base_private->signal2_mmap_base;
 
 			sig->SPU_Sig_Notify_2 = data;
+		} else {
+			errno = EINVAL;
+			return -1;
 		}
 		rc = 0;
 	} else {
@@ -326,8 +329,10 @@ int _base_spe_signal_write(spe_context_p
 			rc = write(open_if_closed(spectx,FD_SIG1, 0), &data, 4);
 		else if (signal_reg == SPE_SIG_NOTIFY_REG_2)
 			rc = write(open_if_closed(spectx,FD_SIG2, 0), &data, 4);
-		else
+		else {
+			errno = EINVAL;
 			return -1;
+		}
 		
 		if (rc == 4)
 			rc = 0;



More information about the cbe-oss-dev mailing list