On Tue, 8 Jan 2008 21:45:18 +0300 Anton Vorontsov <[EMAIL PROTECTED]> wrote:
>
> +int of_mm_gpiochip_add(struct device_node *np,
> +                    const struct of_gpio_chip *of_gc)
> +{
> +     int ret = -ENOMEM;
> +     struct of_mm_gpio_chip *mm_gc;
> +
> +     mm_gc = kzalloc(sizeof(*mm_gc), GFP_KERNEL);
> +     if (!mm_gc)
> +             goto err0;
> +
> +     mm_gc->of_gc = *of_gc;
> +
> +     mm_gc->of_gc.gc.label = kstrdup(np->full_name, GFP_KERNEL);
> +     if (!mm_gc->of_gc.gc.label)
> +             goto err1;
> +
> +     ret = of_get_gpiochip_base(np);
> +     if (ret < 0)
> +             goto err2;
> +
> +     mm_gc->regs = of_iomap(np, 0);
> +     if (!mm_gc->regs) {
> +             ret = -ENOMEM;
> +             goto err1;

Should this be err2?

> +     }
> +
> +     mm_gc->of_gc.gc.base = ret;
> +
> +     np->data = &mm_gc->of_gc;
> +
> +     ret = gpiochip_add(&mm_gc->of_gc.gc);
> +     if (ret)
> +             goto err2;
> +
> +     of_node_get(np);

Why do you this of_node_get(np) when you do not keep a reference to np in
this routine?

-- 
Cheers,
Stephen Rothwell                    [EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/

Attachment: pgpqzwRTqKivS.pgp
Description: PGP signature

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to