* [PATCH] i2c: ocores: add missed clk_disable_unprepare() on failure paths
@ 2016-08-03 23:38 Alexey Khoroshilov
2016-08-04 18:45 ` Peter Korsgaard
2016-08-14 22:30 ` Wolfram Sang
0 siblings, 2 replies; 3+ messages in thread
From: Alexey Khoroshilov @ 2016-08-03 23:38 UTC (permalink / raw)
To: Peter Korsgaard, Wolfram Sang
Cc: Alexey Khoroshilov, linux-i2c, linux-kernel, ldv-project
clk_disable_unprepare() is missed on failure paths in ocores_i2c_probe().
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
drivers/i2c/busses/i2c-ocores.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index dfa7a4b4a91d..ac88a524143e 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -379,6 +379,7 @@ static int ocores_i2c_of_probe(struct platform_device *pdev,
if (!clock_frequency_present) {
dev_err(&pdev->dev,
"Missing required parameter 'opencores,ip-clock-frequency'\n");
+ clk_disable_unprepare(i2c->clk);
return -ENODEV;
}
i2c->ip_clock_khz = clock_frequency / 1000;
@@ -467,20 +468,21 @@ static int ocores_i2c_probe(struct platform_device *pdev)
default:
dev_err(&pdev->dev, "Unsupported I/O width (%d)\n",
i2c->reg_io_width);
- return -EINVAL;
+ ret = -EINVAL;
+ goto err_clk;
}
}
ret = ocores_init(&pdev->dev, i2c);
if (ret)
- return ret;
+ goto err_clk;
init_waitqueue_head(&i2c->wait);
ret = devm_request_irq(&pdev->dev, irq, ocores_isr, 0,
pdev->name, i2c);
if (ret) {
dev_err(&pdev->dev, "Cannot claim IRQ\n");
- return ret;
+ goto err_clk;
}
/* hook up driver to tree */
@@ -494,7 +496,7 @@ static int ocores_i2c_probe(struct platform_device *pdev)
ret = i2c_add_adapter(&i2c->adap);
if (ret) {
dev_err(&pdev->dev, "Failed to add adapter\n");
- return ret;
+ goto err_clk;
}
/* add in known devices to the bus */
@@ -504,6 +506,10 @@ static int ocores_i2c_probe(struct platform_device *pdev)
}
return 0;
+
+err_clk:
+ clk_disable_unprepare(i2c->clk);
+ return ret;
}
static int ocores_i2c_remove(struct platform_device *pdev)
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: ocores: add missed clk_disable_unprepare() on failure paths
2016-08-03 23:38 [PATCH] i2c: ocores: add missed clk_disable_unprepare() on failure paths Alexey Khoroshilov
@ 2016-08-04 18:45 ` Peter Korsgaard
2016-08-14 22:30 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2016-08-04 18:45 UTC (permalink / raw)
To: Alexey Khoroshilov
Cc: Peter Korsgaard, Wolfram Sang, linux-i2c, linux-kernel,
ldv-project
>>>>> "Alexey" == Alexey Khoroshilov <khoroshilov@ispras.ru> writes:
> clk_disable_unprepare() is missed on failure paths in ocores_i2c_probe().
> Found by Linux Driver Verification project (linuxtesting.org).
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Peter Korsgaard <peter@korsgaard.com>
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i2c: ocores: add missed clk_disable_unprepare() on failure paths
2016-08-03 23:38 [PATCH] i2c: ocores: add missed clk_disable_unprepare() on failure paths Alexey Khoroshilov
2016-08-04 18:45 ` Peter Korsgaard
@ 2016-08-14 22:30 ` Wolfram Sang
1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2016-08-14 22:30 UTC (permalink / raw)
To: Alexey Khoroshilov; +Cc: Peter Korsgaard, linux-i2c, linux-kernel, ldv-project
[-- Attachment #1: Type: text/plain, Size: 318 bytes --]
On Thu, Aug 04, 2016 at 02:38:44AM +0300, Alexey Khoroshilov wrote:
> clk_disable_unprepare() is missed on failure paths in ocores_i2c_probe().
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Applied to for-current, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-14 22:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-03 23:38 [PATCH] i2c: ocores: add missed clk_disable_unprepare() on failure paths Alexey Khoroshilov
2016-08-04 18:45 ` Peter Korsgaard
2016-08-14 22:30 ` Wolfram Sang
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).