Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751961AbdHHFgg (ORCPT ); Tue, 8 Aug 2017 01:36:36 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:37835 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750736AbdHHFgf (ORCPT ); Tue, 8 Aug 2017 01:36:35 -0400 From: Arvind Yadav To: matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH] memory: mtk-smi: Handle return value of clk_prepare_enable Date: Tue, 8 Aug 2017 11:06:07 +0530 Message-Id: <2c1de1862ce9fdefe7653706915c146038b12c4c.1502167256.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <472bce58da459a7c64d0ad1cd39b74fa0fcf77f1.1502167256.git.arvind.yadav.cs@gmail.com> References: <472bce58da459a7c64d0ad1cd39b74fa0fcf77f1.1502167256.git.arvind.yadav.cs@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 958 Lines: 32 clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav --- drivers/memory/mtk-smi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/memory/mtk-smi.c b/drivers/memory/mtk-smi.c index 4afbc41..edf36f0 100644 --- a/drivers/memory/mtk-smi.c +++ b/drivers/memory/mtk-smi.c @@ -321,6 +321,7 @@ static int mtk_smi_common_probe(struct platform_device *pdev) struct resource *res; const struct of_device_id *of_id; enum mtk_smi_gen smi_gen; + int ret; if (!dev->pm_domain) return -EPROBE_DEFER; @@ -359,7 +360,9 @@ static int mtk_smi_common_probe(struct platform_device *pdev) if (IS_ERR(common->clk_async)) return PTR_ERR(common->clk_async); - clk_prepare_enable(common->clk_async); + ret = clk_prepare_enable(common->clk_async); + if (ret) + return ret; } pm_runtime_enable(dev); platform_set_drvdata(pdev, common); -- 1.9.1