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

Gerhard Stenzel gerhard.stenzel at de.ibm.com
Tue Jun 26 19:56:45 EST 2007


Hi,
(Dirk is on vacation, so I am acting for him)

looks good, please apply.

The spec does not explicitly mention EINVAL. Should we augment the spec
that EINVAL means invalid value for the signal_reg parameter?

> 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;
> _______________________________________________
> 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