[RFC PATCH 3/3] pcmcia: soc_common: Handle return value of clk_prepare_enable
From: Dominik Brodowski
Date: Sun Feb 04 2018 - 15:40:00 EST
From: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
clk_prepare_enable() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
CC: Russell King <rmk+kernel@xxxxxxxxxxxxxxx>
Signed-off-by: Dominik Brodowski <linux@xxxxxxxxxxxxxxxxxxxx>
---
drivers/pcmcia/soc_common.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index 764650eb8897..c5f2344c189b 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -191,12 +191,16 @@ static int soc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
int ret = 0, i;
- clk_prepare_enable(skt->clk);
+ ret = clk_prepare_enable(skt->clk);
+ if (ret)
+ return ret;
if (skt->ops->hw_init) {
ret = skt->ops->hw_init(skt);
- if (ret)
+ if (ret) {
+ clk_disable_unprepare(skt->clk);
return ret;
+ }
}
for (i = 0; i < ARRAY_SIZE(skt->stat); i++) {
--
2.16.1