From patchwork Thu Jun 1 10:21:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 9759197 X-Patchwork-Delegate: bhelgaas@google.com 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 C521B60390 for ; Thu, 1 Jun 2017 10:22:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1715284BD for ; Thu, 1 Jun 2017 10:22:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96746284C3; Thu, 1 Jun 2017 10:22:57 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 57631283CE for ; Thu, 1 Jun 2017 10:22:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751842AbdFAKWF (ORCPT ); Thu, 1 Jun 2017 06:22:05 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:35221 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751814AbdFAKWA (ORCPT ); Thu, 1 Jun 2017 06:22:00 -0400 Received: by mail-it0-f65.google.com with SMTP id 67so5107195itx.2; Thu, 01 Jun 2017 03:21: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=cUePxI8DlHGGK+tZaEB7xX9GD5Qj0bkH2srHSnYwdQQ=; b=Ktfl0v7NE58otdJKXyRWPuJnw0Nx2NLrft0Sttzwc0iQMv9eO9RIxWpMjQS6EAMV0z 90+JS6qp3WFc59z9TbF8PH2SeLxpT1pKtb9ahh4Qsj6oxWu9nr2BBDAm8tmgYh/L3OG0 EpjAckDfy9qD5FuBAILDpMiyfzdIBrbTyS1gsdCX/0ZssVlkf2TFjmJ0KrI+lJMx7Psf XNNvd/HZjV8sInq/hwqtaE6+Fsn8jkysjOXUTQk8/dxJI5e7ty93ep6HhiIAKg/6QvW0 ymtUdNHQAAJPnTFZ/y+zg0OVgVv1laol/z6hQXmouug/gs/CFfg5Mb9O8bP0qwpWVE9H MJQA== 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=cUePxI8DlHGGK+tZaEB7xX9GD5Qj0bkH2srHSnYwdQQ=; b=cxfMtEyd2AIs84uEYghMyXLvcg2s3Qxx/Gxp589VG4d2RzqYBWoVHGsT7Qy/I0dMcq WeJMuW59kW6fzQf2UUOyDvPjlEAco22jJ4m3k3M6WBc37HrI2ULf3hadcIcabyIx5sg+ 976WCjULgQry8TfvHQcW/X+akqUwG/i2qI0eJK7U/mzvY33NsC/UMPQicrNp+IyByNsG 9zIhVQq27N9GBTCKrnc7Z391lXbo9KfBgNaNCgs6LMydE+23b0XFdCgsT/G9wyhdBoGI YBRPXRSTOas03ckqnPA5ObuX69eVK0w3fWnWZW2cOvSYh18bMCb0qP3k4SNb8foPwZ5y V79Q== X-Gm-Message-State: AODbwcDCdcXH3/gY3DsxTi4crkTaUVLT4+b2fXjj20DA+sgjRiyf7dE7 oof32AT8omafvLeRA5Q= X-Received: by 10.99.218.69 with SMTP id l5mr416305pgj.88.1496312519224; Thu, 01 Jun 2017 03:21:59 -0700 (PDT) Received: from symbol-HP-Z420-Workstation.zebra.lan ([223.31.70.102]) by smtp.googlemail.com with ESMTPSA id v9sm32876728pfa.43.2017.06.01.03.21.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Jun 2017 03:21:58 -0700 (PDT) From: Arvind Yadav To: shawn.lin@rock-chips.com, wenrui.li@rock-chips.com, heiko@sntech.de Cc: linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] PCI: rockchip: Handle return value of clk_prepare_enable Date: Thu, 1 Jun 2017 15:51:45 +0530 Message-Id: <4ebfc69644f9d6e9e5ff0cfc82e9efa5c476be0e.1496312348.git.arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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 Acked-by: Shawn Lin Reviewed-by: Heiko Stuebner --- drivers/pci/host/pcie-rockchip.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/pci/host/pcie-rockchip.c b/drivers/pci/host/pcie-rockchip.c index 0e020b6..0a248cd 100644 --- a/drivers/pci/host/pcie-rockchip.c +++ b/drivers/pci/host/pcie-rockchip.c @@ -1259,24 +1259,46 @@ static int __maybe_unused rockchip_pcie_resume_noirq(struct device *dev) struct rockchip_pcie *rockchip = dev_get_drvdata(dev); int err; - clk_prepare_enable(rockchip->clk_pcie_pm); - clk_prepare_enable(rockchip->hclk_pcie); - clk_prepare_enable(rockchip->aclk_perf_pcie); - clk_prepare_enable(rockchip->aclk_pcie); + err = clk_prepare_enable(rockchip->clk_pcie_pm); + if (err) + goto err_pcie_pm; + + err = clk_prepare_enable(rockchip->hclk_pcie); + if (err) + goto err_hclk_pcie; + + err = clk_prepare_enable(rockchip->aclk_perf_pcie); + if (err) + goto err_aclk_perf_pcie; + + err = clk_prepare_enable(rockchip->aclk_pcie); + if (err) + goto err_aclk_pcie; err = rockchip_pcie_init_port(rockchip); if (err) - return err; + goto err_pcie_resume; err = rockchip_cfg_atu(rockchip); if (err) - return err; + goto err_pcie_resume; /* Need this to enter L1 again */ rockchip_pcie_update_txcredit_mui(rockchip); rockchip_pcie_enable_interrupts(rockchip); return 0; + +err_pcie_resume: + clk_disable_unprepare(rockchip->aclk_pcie); +err_aclk_pcie: + clk_disable_unprepare(rockchip->aclk_perf_pcie); +err_aclk_perf_pcie: + clk_disable_unprepare(rockchip->hclk_pcie); +err_hclk_pcie: + clk_disable_unprepare(rockchip->clk_pcie_pm); +err_pcie_pm: + return err; } static int rockchip_pcie_probe(struct platform_device *pdev)