[Openchrome-devel] openchrome bug

Jon Nettleton jon.nettleton
Fri Jan 16 14:41:14 PST 2009

On Wed, Jan 14, 2009 at 7:19 PM, Bartosz Kosiorek <gang65 at poczta.onet.pl> wrote:
> Hi.
> I found bug in libxvmc/viaLowLevel.c
> The function always return 0, even if drmCommandWriteRead was failed.
> I think it should be:
> -       if (drmCommandWriteRead(xl->fd, DRM_VIA_ALLOCMEM, &xl->tsMem,
> -               sizeof(xl->tsMem)) < 0)
> +       if ((ret = drmCommandWriteRead(xl->fd, DRM_VIA_ALLOCMEM, &xl->tsMem,
> +               sizeof(xl->tsMem))) < 0)
>            return ret;
> I also use common code convention for "drmCommandRead",
> "drmCommandWriteRead"  and "drmCommandWrite", to avoid mistakes.
> The return values of the functions: "drmCommandRead",
> "drmCommandWriteRead"  and "drmCommandWrite" should be zero on
> success, or a negative values on failure.


Thanks for your time and effort.  I have checked in the parts of the
patch that would functionally change the way the code works.  I have
not checked in syntax of the logic changes that you submitted because
it would break code uniformity with most of the xorg drivers that

Could someone else on the list that has more history with xorg give us
some understanding why when checking the ret of drmCommand functions
we use this?

 - if (ret) {

instead of

 + if (ret < 0) {

If there is a reason other than personal preference to change this I
will.  My take is to stick with the rest of the community on this one.


More information about the Openchrome-devel mailing list