On Thu, 29 Mar 2012, Peter A. G. Crosthwaite wrote:

> Device model for Primecell PL330 dma controller.
> 
> Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwa...@petalogix.com>
> ---

Signed-off-by: Kirill Batuzov <batuz...@ispras.ru>

> +static int PL330Fifo_get(PL330Fifo *s, uint8_t *buf, int len, uint8_t tag)
> +{
> +    int i, ret;
> +    int old_s, old_t;
> +
> +    old_s = s->s;
> +    old_t = s->t;
> +    for (i = 0; i < len; i++) {
> +        if (s->t != s->s && s->tag[s->s] == tag) {
> +            buf[i] = s->buf[s->s];
> +            s->s = PL330Fifo_inc(s->s, s->buf_size);
> +        } else {
> +            /* Rollback transaction */
> +            ret = (s->t == s->s) ? ret = PL330FIFO_STALL : PL330FIFO_ERR;
Minor issue - double assignement of ret in this line.
> +            s->s = old_s;
> +            s->t = old_t;
> +            return ret;
> +        }
> +    }
> +    return PL330FIFO_OK;
> +}

-- 
Kirill Batuzov

Reply via email to