diff mbox

[1/2] clk: gpio-gate: Stop using devres API

Message ID 59d52e97a4954e0593a9aebc5b7d0d968a10f485.1412234778.git.jsarha@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jyri Sarha Oct. 2, 2014, 7:53 a.m. UTC
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(-)
diff mbox

Patch

diff --git a/drivers/clk/clk-gpio-gate.c b/drivers/clk/clk-gpio-gate.c
index b87e5f0..a648761 100644
--- a/drivers/clk/clk-gpio-gate.c
+++ b/drivers/clk/clk-gpio-gate.c
@@ -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);