crypto: tegra: Check return value for clk_*() calls

Check return value for clk_prepare_enable calls to fix the
coverity issue.

ID 10162284
ID 10162277
ID 10162262

Bug 3952896

Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
Change-Id: I881a806b1f810c1c99c068dd45196c7e9bb49f39
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2870248
Reviewed-by: Kartik . <kkartik@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Rakesh Babu Bodla <rbodla@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Akhil R
2023-03-13 19:49:02 +05:30
committed by mobile promotions
parent 79aa81a101
commit 698c663564

View File

@@ -3,7 +3,7 @@
*
* Support for Tegra NVRNG Engine Error Handling.
*
* Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -159,6 +159,7 @@ static int tegra_se_nvrng_request_irq(struct tegra_se_nvrng_dev *nvrng_dev)
static int tegra_se_nvrng_probe(struct platform_device *pdev)
{
struct tegra_se_nvrng_dev *nvrng_dev;
int ret;
nvrng_dev = devm_kzalloc(&pdev->dev, sizeof(struct tegra_se_nvrng_dev),
GFP_KERNEL);
@@ -186,7 +187,11 @@ static int tegra_se_nvrng_probe(struct platform_device *pdev)
if (IS_ERR(nvrng_dev->clk))
return PTR_ERR(nvrng_dev->clk);
clk_prepare_enable(nvrng_dev->clk);
ret = clk_prepare_enable(nvrng_dev->clk);
if (ret) {
dev_err(&pdev->dev, "failed to initialize clocks\n");
return ret;
}
clk_set_rate(nvrng_dev->clk, CLK_RATE);
platform_set_drvdata(pdev, nvrng_dev);
@@ -266,7 +271,11 @@ static int tegra_se_nvrng_suspend(struct device *dev)
int ret = 0;
/* 1. Enable clock */
clk_prepare_enable(nvrng_dev->clk);
ret = clk_prepare_enable(nvrng_dev->clk);
if (ret) {
dev_err(dev, "failed to enable clocks during suspend\n");
return ret;
}
/* 2. Program NV_NVRNG_R_CTRL0_0.SW_ENGINE_ENABLED to true */
tegra_se_nvrng_writel(nvrng_dev, NV_NVRNG_R_CTRL0_0, SW_ENGINE_ENABLED);
@@ -308,7 +317,11 @@ static int tegra_se_nvrng_resume(struct device *dev)
int ret = 0;
/* 1. Enable clock */
clk_prepare_enable(nvrng_dev->clk);
ret = clk_prepare_enable(nvrng_dev->clk);
if (ret) {
dev_err(dev, "failed to enable clocks during resume\n");
return ret;
}
/* 2. Program NV_NVRNG_R_CTRL0_0.SW_ENGINE_ENABLED to true */
tegra_se_nvrng_writel(nvrng_dev, NV_NVRNG_R_CTRL0_0, SW_ENGINE_ENABLED);