pcmcia: soc_common: Handle return value of clk_prepare_enable

"Linux Kernel Mailing List" <[email protected]>
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/d3fdd701248290b511683ff8d348073295f07833
Commit:     d3fdd701248290b511683ff8d348073295f07833
Parent:     3490a69bdd815ab38230c993b3a6e02937237ac8
Refname:    refs/heads/master
Author:     Arvind Yadav <[email protected]>
AuthorDate: Thu Jun 1 16:17:10 2017 +0530
Committer:  Dominik Brodowski <[email protected]>
CommitDate: Wed Jan 24 19:24:39 2018 +0100

    pcmcia: soc_common: Handle return value of clk_prepare_enable
    
    clk_prepare_enable() can fail here and we must check its return value.
    
    Signed-off-by: Arvind Yadav <[email protected]>
    CC: Russell King <[email protected]>
    Signed-off-by: Dominik Brodowski <[email protected]>
---
 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++) {
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.