video: tegra: tsec: fix static analysis issues

Remove address space errors by casting properly. Also make variables
static if used within the same translation unit.

Bug 3528414

Change-Id: Id9d566f5b5c9594c69a1483d2945712e6c9f665c
Signed-off-by: Sahil Mukund Patki <spatki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2835170
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sahil Mukund Patki
2022-12-30 05:17:40 +00:00
committed by Laxman Dewangan
parent 78db0d7c41
commit 6df40510f9
2 changed files with 12 additions and 11 deletions

View File

@@ -23,13 +23,13 @@
* TSEC Device Data
*/
struct tsec_device_data t23x_tsec_data = {
static struct tsec_device_data t23x_tsec_data = {
.rate = {192000000, 0, 204000000},
.riscv_desc_bin = "tegra23x/nvhost_tsec_desc.fw",
.riscv_image_bin = "tegra23x/nvhost_tsec_riscv.fw",
};
struct tsec_device_data t239_tsec_data = {
static struct tsec_device_data t239_tsec_data = {
.rate = {192000000, 0, 204000000},
.riscv_desc_bin = "tegra239/nvhost_tsec_desc.fw",
.riscv_image_bin = "tegra239/nvhost_tsec_riscv.fw",
@@ -259,7 +259,7 @@ static int tsec_module_init(struct platform_device *dev)
}
const struct dev_pm_ops tsec_module_pm_ops = {
const static struct dev_pm_ops tsec_module_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(tsec_module_suspend, tsec_module_resume)
};
@@ -303,7 +303,7 @@ static int tsec_remove(struct platform_device *dev)
return tsec_poweroff(&dev->dev);
}
struct platform_driver tsec_driver = {
static struct platform_driver tsec_driver = {
.probe = tsec_probe,
.remove = tsec_remove,
.driver = {

View File

@@ -2,7 +2,7 @@
/*
* Tegra TSEC Module Support
*
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2022-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,
@@ -24,6 +24,7 @@
#include "tsec_regs.h"
#include "tsec_cmds.h"
#include "tsec_comms/tsec_comms.h"
#include "tsec_comms/tsec_comms_plat.h"
#define CMD_INTERFACE_TEST 0
#if CMD_INTERFACE_TEST
@@ -61,7 +62,7 @@ struct carveout_info {
* Platform specific APIs to be used by platform independent comms library
*/
DEFINE_MUTEX(s_plat_comms_mutex);
static DEFINE_MUTEX(s_plat_comms_mutex);
void tsec_plat_acquire_comms_mutex(void)
{
@@ -126,9 +127,9 @@ static int tsec_compute_ucode_offsets(struct platform_device *dev,
struct RM_RISCV_UCODE_DESC *ucode_desc;
ucode_desc = (struct RM_RISCV_UCODE_DESC *)fw_desc->data;
rv_data->desc.manifest_offset = le32_to_cpu(ucode_desc->manifestOffset);
rv_data->desc.code_offset = le32_to_cpu(ucode_desc->monitorCodeOffset);
rv_data->desc.data_offset = le32_to_cpu(ucode_desc->monitorDataOffset);
rv_data->desc.manifest_offset = le32_to_cpu((__force __le32)ucode_desc->manifestOffset);
rv_data->desc.code_offset = le32_to_cpu((__force __le32)ucode_desc->monitorCodeOffset);
rv_data->desc.data_offset = le32_to_cpu((__force __le32)ucode_desc->monitorDataOffset);
return 0;
}
@@ -394,7 +395,7 @@ int tsec_finalize_poweron(struct platform_device *dev)
goto clean_up;
}
dev_dbg(&dev->dev, "IPCCO va=0x%llx pa=0x%llx\n",
(phys_addr_t)(ipc_co_va), page_to_phys(vmalloc_to_page(ipc_co_va)));
(__force phys_addr_t)(ipc_co_va), page_to_phys(vmalloc_to_page(ipc_co_va)));
#if (KERNEL_VERSION(5, 10, 0) <= LINUX_VERSION_CODE)
ipc_co_iova = dma_map_page_attrs(&dev->dev, vmalloc_to_page(ipc_co_va),
offset_in_page(ipc_co_va), ipc_co_info.size, DMA_BIDIRECTIONAL, 0);
@@ -505,7 +506,7 @@ int tsec_finalize_poweron(struct platform_device *dev)
*/
tsec_writel(pdata, tsec_riscv_irqmclr_r(), tsec_riscv_irqmclr_swgen1_set_f());
/* initialise the comms library before enabling msg interrupt */
tsec_comms_initialize((u64)ipc_co_va, ipc_co_info.size);
tsec_comms_initialize((__force u64)ipc_co_va, ipc_co_info.size);
/* enable message interrupt from tsec to ccplex */
enable_irq(pdata->irq);