lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 2 Oct 2014 10:53:31 +0300
From:	Jyri Sarha <jsarha@...com>
To:	<linux-kernel@...r.kernel.org>, <linux-omap@...r.kernel.org>,
	Mike Turquette <mturquette@...aro.org>,
	<kernel-janitors@...r.kernel.org>
CC:	<dan.carpenter@...cle.com>, <detheridge@...com>,
	Jyri Sarha <jsarha@...com>
Subject: [PATCH 1/2] clk: gpio-gate: Stop using devres API

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@...com>
---
 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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ