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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 drivers/clk/clk-gpio-gate.c |   16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

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);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux