On Fri, 22 Jan 2010 18:54:46 -0200
Mauro Carvalho Chehab <mche...@infradead.org> wrote:

> Huh?
> -static int reg_w_buf(struct gspca_dev *gspca_dev,
> +static void reg_w_buf(struct gspca_dev *gspca_dev,
>                   __u8 index,
>                   const char *buffer, int len)
>  {
>         int ret;
>  
> +       if (gspca_dev->usb_err < 0)
> +               return;
> 
> This is an ugly and non-standard way to report errors in C. Just
> return the error code.

Perhaps, but a code as:

        foo(x);
        bar(y);
        bla(z);
        ...

is more readable, smaller and quicker (less MMU switches) than:

        rc = foo(x);
        if (rc < 0)
                return rc;
        rc = bar(y);
        if (rc < 0)
                return rc;
        rc = bla(z);
        if (rc < 0)
                return rc;
        ...

An other way to do it is to use longjump, but I don't think it works in
the kernel...

Best regards.

-- 
Ken ar c'hentañ |             ** Breizh ha Linux atav! **
Jef             |               http://moinejf.free.fr/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to