linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: si5351: implement remove handler
@ 2017-09-15 22:30 Alexey Khoroshilov
  2017-12-22  2:11 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Khoroshilov @ 2017-09-15 22:30 UTC (permalink / raw)
  To: Sebastian Hesselbarth, Stephen Boyd
  Cc: Alexey Khoroshilov, Michael Turquette, linux-clk, linux-kernel,
	ldv-project

The driver has no remove function, so it does not cleanup
resources that are not under devm management.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/clk/clk-si5351.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c
index 20d90769cced..36a15f161dfd 100644
--- a/drivers/clk/clk-si5351.c
+++ b/drivers/clk/clk-si5351.c
@@ -1619,6 +1619,18 @@ static int si5351_i2c_probe(struct i2c_client *client,
 	return ret;
 }
 
+static int si5351_i2c_remove(struct i2c_client *client)
+{
+	struct si5351_driver_data *drvdata = i2c_get_clientdata(client);
+
+	of_clk_del_provider(client->dev.of_node);
+	if (!IS_ERR(drvdata->pxtal))
+		clk_disable_unprepare(drvdata->pxtal);
+	if (!IS_ERR(drvdata->pclkin))
+		clk_disable_unprepare(drvdata->pclkin);
+	return 0;
+}
+
 static const struct i2c_device_id si5351_i2c_ids[] = {
 	{ "si5351a", SI5351_VARIANT_A },
 	{ "si5351a-msop", SI5351_VARIANT_A3 },
@@ -1634,6 +1646,7 @@ static struct i2c_driver si5351_driver = {
 		.of_match_table = of_match_ptr(si5351_dt_ids),
 	},
 	.probe = si5351_i2c_probe,
+	.remove = si5351_i2c_remove,
 	.id_table = si5351_i2c_ids,
 };
 module_i2c_driver(si5351_driver);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: si5351: implement remove handler
  2017-09-15 22:30 [PATCH] clk: si5351: implement remove handler Alexey Khoroshilov
@ 2017-12-22  2:11 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2017-12-22  2:11 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Sebastian Hesselbarth, Michael Turquette, linux-clk, linux-kernel,
	ldv-project

On 09/16, Alexey Khoroshilov wrote:
> The driver has no remove function, so it does not cleanup
> resources that are not under devm management.
> 
> Found by Linux Driver Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-22  2:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-15 22:30 [PATCH] clk: si5351: implement remove handler Alexey Khoroshilov
2017-12-22  2:11 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).