Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751691AbdFAKrZ (ORCPT ); Thu, 1 Jun 2017 06:47:25 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:35401 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751521AbdFAKrX (ORCPT ); Thu, 1 Jun 2017 06:47:23 -0400 From: Arvind Yadav To: rmk+kernel@armlinux.org.uk Cc: linux-pcmcia@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] pcmcia: soc_common: Handle return value of clk_prepare_enable Date: Thu, 1 Jun 2017 16:17:10 +0530 Message-Id: X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 805 Lines: 32 clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- 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 b6b316d..c8cbf27 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++) { -- 1.9.1