nvidia-oot: cameraSW: add data validation to dt reads

+ Add the following data validation checks based on
  gaps identified when inspecting code for
  SHR-9320:
  + FSYNC: Add check to ensure existence of generators
    property before parse
  + FSYNC: Add check to ensure generators in default
    group adhere to LCM rule
  + CDI: Add check to ensure reg_len / dat_len do
    not exceed 2 bytes
  + CDI: Ensure err is set before jumping to err_probe
  + CDI: Jump to err_probe if IOExpander i2c-bus read
    fails
  + CDI-TCA: Return error if reg_len or dat_len
    out of expected range
  + FuSaCap: Ensure isp/vi-max-channels validated
  + VI: Add check for vi-mapping index found (this was
    already caught in existing code, but error message
    was non-specific)
  + camera_common: Add check for err that was set but
    never read
  + RTCPU: Add debug prints for properties not found

Jira CAMERASW-30537
Change-Id: I9953029f594c0153d6c335913944fb8906adedd9
Signed-off-by: kevixie <kevixie@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3280557
Reviewed-by: Vincent Chung <vincentc@nvidia.com>
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
kevixie
2025-01-03 16:23:18 -08:00
committed by Jon Hunter
parent 0b94a70702
commit 5ce08ee3ce
7 changed files with 208 additions and 49 deletions

View File

@@ -1,5 +1,17 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/* SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES.
* 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,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*/
#include <nvidia/conftest.h>
#include <linux/tegra-camera-rtcpu.h>
@@ -832,7 +844,9 @@ static int tegra_cam_rtcpu_probe(struct platform_device *pdev)
}
name = pdata->name;
of_property_read_string(dev->of_node, "nvidia,cpu-name", &name);
ret = of_property_read_string(dev->of_node, "nvidia,cpu-name", &name);
if (ret)
dev_dbg(dev, "no device property, cpu-name, setting to parent name\n");
dev_dbg(dev, "probing RTCPU on %s\n", name);
@@ -854,11 +868,15 @@ static int tegra_cam_rtcpu_probe(struct platform_device *pdev)
goto fail;
rtcpu->max_reboot_retry = 3;
(void)of_property_read_u32(dev->of_node, NV(max-reboot),
ret = of_property_read_u32(dev->of_node, NV(max-reboot),
&rtcpu->max_reboot_retry);
if (ret)
dev_dbg(dev, "no device property, max-reboot, setting to default (3)\n");
timeout = 2000;
(void)of_property_read_u32(dev->of_node, "nvidia,cmd-timeout", &timeout);
ret = of_property_read_u32(dev->of_node, "nvidia,cmd-timeout", &timeout);
if (ret)
dev_dbg(dev, "no device property, cmd-timeout, setting to default (2000)\n");
rtcpu->cmd_timeout = msecs_to_jiffies(timeout);