From patchwork Mon Jun 12 10:53:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9780751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C194060244 for ; Mon, 12 Jun 2017 10:54:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B45A82811E for ; Mon, 12 Jun 2017 10:54:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A82CA285CA; Mon, 12 Jun 2017 10:54:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53D942811E for ; Mon, 12 Jun 2017 10:54:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752699AbdFLKyC (ORCPT ); Mon, 12 Jun 2017 06:54:02 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33106 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752581AbdFLKyA (ORCPT ); Mon, 12 Jun 2017 06:54:00 -0400 Received: by mail-pf0-f193.google.com with SMTP id w12so6098075pfk.0; Mon, 12 Jun 2017 03:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=/2DKAYlYlvWDNz6U+rZEZi0f7MTkGVztR0wxhQSvK8c=; b=oCgR2RRkemDMiGYnZcop8In/TcSrfKnpJfeoXGMUimcGxM7QMKti07nXHC9yz2Ga34 G4FPq8uY9wjk28PDXoXSYg0sp5mZBxkFJaq6d5duxgBEFM23BEvkuF/GeOdxI13m7QuW Zc6OFfDmwk/RTuWLNsdKjG8v9x6Ae982yWkPU6zmc3Cqyp9O7W1qxbLEB25yOEbeX9WO rKm0LFGA0I2ZrYTdA1Lr44vi/fEzUP2hXgtNzv6CiagGn3Tz5nh5dvbu/u1uCrKxxGC9 EgQe2dNyAm/Z0OQgVtfxIZ+HZ1eeeuovgkT2xohUFRa9lqHIWpBHam6os/w0I1SiXR9R uM/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/2DKAYlYlvWDNz6U+rZEZi0f7MTkGVztR0wxhQSvK8c=; b=FQBWc0bochEkKn5dgwNMt1R6Y6cWtpePuDH6hwKZ8WfNfF1PtDFd1pAUMHVotyIOyl Bhf47Fzf0pyhhqQi9ybqJ3O0Nc/eFNQZwj2dR6WK/7C61rVRq+FP57iX7wrSRWpIiqIl wynydHUV0y4eKtBUovokxGCHS/yAurAkyeYn3UrxgDEUj+pd6tpi/eNJ4DJ5mnT323wK Svx2yKKbHI8XGczU87aQZFlz1V/3DM/F9k6z0Tk97hAd9g6Wx9VrM883g0VIxNll7RIQ yD2J53YfOv5TOQIu/HuMjvr2rDMP2nyBqRZRQ/mhCUAW91Xm3BvzzUuIokbKVrG13RFf jQag== X-Gm-Message-State: AODbwcATbwyCGNfGDs0bsEFYttp6Lkppzsc1eS/jphWV8ad1U3N7/iEh OTZBxpUfQQO+Uw== X-Received: by 10.99.108.193 with SMTP id h184mr55286576pgc.166.1497264839204; Mon, 12 Jun 2017 03:53:59 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id x12sm17391859pgc.47.2017.06.12.03.53.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Jun 2017 03:53:57 -0700 (PDT) From: Arvind Yadav To: balbi@kernel.org, kgene@kernel.org, krzk@kernel.org, javier@osg.samsung.com Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: dwc3: exynos: Handle return value of clk_prepare_enable Date: Mon, 12 Jun 2017 16:23:31 +0530 Message-Id: <3e8b3037c345341c2bda612b6de204f6c83dde38.1497264433.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP clk_prepare_enable() can fail here and we must check its return value. Signed-off-by: Arvind Yadav Reviewed-by: Krzysztof Kozlowski --- drivers/usb/dwc3/dwc3-exynos.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 98f74ff..e089df7 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -125,12 +125,16 @@ static int dwc3_exynos_probe(struct platform_device *pdev) dev_err(dev, "couldn't get clock\n"); return -EINVAL; } - clk_prepare_enable(exynos->clk); + ret = clk_prepare_enable(exynos->clk); + if (ret) + return ret; exynos->susp_clk = devm_clk_get(dev, "usbdrd30_susp_clk"); if (IS_ERR(exynos->susp_clk)) exynos->susp_clk = NULL; - clk_prepare_enable(exynos->susp_clk); + ret = clk_prepare_enable(exynos->susp_clk); + if (ret) + goto susp_clk_err; if (of_device_is_compatible(node, "samsung,exynos7-dwusb3")) { exynos->axius_clk = devm_clk_get(dev, "usbdrd30_axius_clk"); @@ -139,7 +143,9 @@ static int dwc3_exynos_probe(struct platform_device *pdev) ret = -ENODEV; goto axius_clk_err; } - clk_prepare_enable(exynos->axius_clk); + ret = clk_prepare_enable(exynos->axius_clk); + if (ret) + goto axius_clk_err; } else { exynos->axius_clk = NULL; } @@ -197,6 +203,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev) clk_disable_unprepare(exynos->axius_clk); axius_clk_err: clk_disable_unprepare(exynos->susp_clk); +susp_clk_err: clk_disable_unprepare(exynos->clk); return ret; }