@@ -82,23 +82,14 @@ struct clk *clk_register_gpio_gate(struct device *dev, const char *name,
else
gpio_flags = GPIOF_OUT_INIT_LOW;
- if (dev)
- err = devm_gpio_request_one(dev, desc_to_gpio(gpiod),
- gpio_flags, name);
- else
- err = gpio_request_one(desc_to_gpio(gpiod), gpio_flags, name);
-
+ err = gpio_request_one(desc_to_gpio(gpiod), gpio_flags, name);
if (err) {
pr_err("%s: %s: Error requesting clock control gpio %u\n",
__func__, name, desc_to_gpio(gpiod));
return ERR_PTR(err);
}
- if (dev)
- clk_gpio = devm_kzalloc(dev, sizeof(struct clk_gpio),
- GFP_KERNEL);
- else
- clk_gpio = kzalloc(sizeof(struct clk_gpio), GFP_KERNEL);
+ clk_gpio = kzalloc(sizeof(struct clk_gpio), GFP_KERNEL);
if (!clk_gpio) {
clk = ERR_PTR(-ENOMEM);
@@ -119,8 +110,7 @@ struct clk *clk_register_gpio_gate(struct device *dev, const char *name,
if (!IS_ERR(clk))
return clk;
- if (!dev)
- kfree(clk_gpio);
+ kfree(clk_gpio);
clk_register_gpio_gate_err:
gpiod_put(gpiod);
If some driver calls clk_register_gpio_gate() directly, then the driver needs to kfree the resulting struct clk pointer in remove function. Signed-off-by: Jyri Sarha <jsarha@ti.com> --- drivers/clk/clk-gpio-gate.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)