clk: max77686: Avoid double free at remove time
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 7 Jan 2013 01:05:19 +0000 (02:05 +0100)
committerMike Turquette <mturquette@linaro.org>
Wed, 16 Jan 2013 00:16:26 +0000 (16:16 -0800)
The clk_lookup entry is dropped at remove time by a call to
clkdev_drop(). That function frees the entry, which is also freed by the
driver core as it has been allocated through devm_kzalloc(). This
results in a double free.

Use kzalloc() instead of devm_kzalloc() to fix this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
drivers/clk/clk-max77686.c

index 90bf59cf9d2576c610845cad6e2238025947fdb6..9f57bc37cd60a3e7559c3972e2eb0ac55145b2b9 100644 (file)
@@ -116,8 +116,7 @@ static int max77686_clk_register(struct device *dev,
        if (IS_ERR(clk))
                return -ENOMEM;
 
-       max77686->lookup = devm_kzalloc(dev, sizeof(struct clk_lookup),
-                                       GFP_KERNEL);
+       max77686->lookup = kzalloc(sizeof(struct clk_lookup), GFP_KERNEL);
        if (!max77686->lookup)
                return -ENOMEM;