diff options
-rw-r--r-- | drivers/clk/clkdev.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c index a0fd90f07891..ee37d0be6877 100644 --- a/drivers/clk/clkdev.c +++ b/drivers/clk/clkdev.c @@ -346,9 +346,9 @@ int clk_hw_register_clkdev(struct clk_hw *hw, const char *con_id, } EXPORT_SYMBOL(clk_hw_register_clkdev); -static void devm_clkdev_release(struct device *dev, void *res) +static void devm_clkdev_release(void *res) { - clkdev_drop(*(struct clk_lookup **)res); + clkdev_drop(res); } /** @@ -369,17 +369,13 @@ static void devm_clkdev_release(struct device *dev, void *res) int devm_clk_hw_register_clkdev(struct device *dev, struct clk_hw *hw, const char *con_id, const char *dev_id) { - int rval = -ENOMEM; - struct clk_lookup **cl; - - cl = devres_alloc(devm_clkdev_release, sizeof(*cl), GFP_KERNEL); - if (cl) { - rval = do_clk_register_clkdev(hw, cl, con_id, dev_id); - if (!rval) - devres_add(dev, cl); - else - devres_free(cl); - } - return rval; + struct clk_lookup *cl; + int rval; + + rval = do_clk_register_clkdev(hw, &cl, con_id, dev_id); + if (rval) + return rval; + + return devm_add_action_or_reset(dev, devm_clkdev_release, cl); } EXPORT_SYMBOL(devm_clk_hw_register_clkdev); |