Re: [PATCH 1/6] Clocklib: add generic framework for managing clocks.

From: Pavel Machek
Date: Mon Mar 31 2008 - 10:55:31 EST



> +int __must_check clk_register(struct clk *clk);
> +void clk_unregister(struct clk *clk);
> +static void __maybe_unused clks_unregister(struct clk **clks, size_t num)
> +{
> + int i;
> + for (i = num - 1; i >= 0; i++) {
> + clk_unregister(clks[i]);
> + }
> +}
> +
> +static int __must_check __maybe_unused clks_register(struct clk **clks, size_t num)
> +{
> + int i;
> + int ret;
> + for (i = 0; i < num; i++) {
> + ret = clk_register(clks[i]);
> + if (ret != 0)
> + goto cleanup;
> + }
> +
> + return 0;
> +
> +cleanup:
> + clks_unregister(clks, i);
> +
> + for (i -- ; i >= 0; i--) {

"for (i--;"
> + clk_unregister(clks[i]);
> + }
> +
> + return ret;

Hmm, clk_unregister is _very_ similar to clks_unregister....
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/