On Fri, Oct 3, 2014 at 1:52 PM, Hans de Goede <hdegoede@xxxxxxxxxx> wrote: > +static void > +simplefb_clocks_init(struct platform_device *pdev, struct list_head *list) > +{ > + struct device_node *np = pdev->dev.of_node; > + int clock_count, i; > + > + INIT_LIST_HEAD(list); > + > + if (dev_get_platdata(&pdev->dev) || !np) > + return; > + > + clock_count = of_clk_get_parent_count(np); > + for (i = 0; i < clock_count; i++) { > + struct simplefb_clock *entry; > + struct clk *clock = of_clk_get(np, i); > + int ret; > + > + if (IS_ERR(clock)) { > + dev_err(&pdev->dev, "%s: clock %d not found: %ld\n", > + __func__, i, PTR_ERR(clock)); > + continue; > + } > + > + ret = clk_prepare_enable(clock); > + if (ret) { > + dev_err(&pdev->dev, > + "%s: failed to enable clock %d: %d\n", > + __func__, i, ret); > + clk_put(clock); > + continue; > + } > + > + entry = kzalloc(sizeof(struct simplefb_clock), GFP_KERNEL); > + if (!entry) { > + clk_disable_unprepare(clock); > + clk_put(clock); > + continue; > + } I'd allocate memory first, to avoid calling clk_disable_unprepare() (which will kill your display) if memory allocation fails. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html