clk: gpio: Unlock mutex on error path
authorStephen Boyd <sboyd@codeaurora.org>
Tue, 14 Jul 2015 19:45:19 +0000 (12:45 -0700)
committerStephen Boyd <sboyd@codeaurora.org>
Tue, 28 Jul 2015 18:51:39 +0000 (11:51 -0700)
We don't unlock the mutex if we fail to allocate the parent names
array. Unlock it and return an error in this case as well.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Cc: Sergej Sawazki <ce3a@gmx.de>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/clk-gpio.c

index c0d202c24a97e7558aa77a6e3ba16b5e83148399..41277a1526c76fbaa4f8849f555ab46446627c93 100644 (file)
@@ -251,8 +251,10 @@ static struct clk *of_clk_gpio_delayed_register_get(
        num_parents = of_clk_get_parent_count(data->node);
 
        parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL);
-       if (!parent_names)
-               return ERR_PTR(-ENOMEM);
+       if (!parent_names) {
+               clk = ERR_PTR(-ENOMEM);
+               goto out;
+       }
 
        for (i = 0; i < num_parents; i++)
                parent_names[i] = of_clk_get_parent_name(data->node, i);