platform: tegra: rtcpu: Fix mixed declarations and code

The RTCPU driver fails to build with the compiler option
'-Werror=declaration-after-statement' and the following errors are
observed ...

 drivers/platform/tegra/rtcpu/camera-diagnostics.c:900:17: error: ISO
  C90 forbids mixed declarations and code
  [-Werror=declaration-after-statement]
  900 |                 unsigned long end_time = 0U;
      |                 ^~~~~~~~

 drivers/platform/tegra/rtcpu/camera-diagnostics.c:904:17: error: ISO
  C90 forbids mixed declarations and code
  [-Werror=declaration-after-statement]
  904 |  bool all_tests_pass = (status.executed > 0 &&
                                status.passed == status.executed);
      |  ^~~~

Fix this by declaring the necssary variables at the beginning of the
functions.

Jira CAMERASW-32042
Jira CAMERASW-32960

Change-Id: I6bc652b19f77f0a9bbbe3263cdff371acbc957d7
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3334920
Reviewed-by: Zhiyuan Wang <zhiwang@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Mohit Ingale <mohiti@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2025-04-07 11:16:33 +01:00
parent 659e731f28
commit 53584a0920

View File

@@ -873,7 +873,8 @@ static ssize_t status_show(struct device *dev, struct device_attribute *attr, ch
struct camera_diag_channel *ch = dev_get_drvdata(dev);
struct camrtc_diag_isp5_sdl_status_resp status;
int err, i;
unsigned long start_time;
unsigned long start_time, end_time;
bool all_tests_pass;
ssize_t pos = 0;
if (ch == NULL)
@@ -894,7 +895,7 @@ static ssize_t status_show(struct device *dev, struct device_attribute *attr, ch
start_time = jiffies;
err = camera_diag_isp_sdl_status(ch, &status, i);
unsigned long end_time = 0U;
end_time = 0U;
(void)__builtin_add_overflow(start_time, msecs_to_jiffies(1000), &end_time);
if (time_after(jiffies, end_time) || err != 0) {
pos += sprintf(buf + pos, "\nISP%d: Error getting diagnostic status: %d\n", i, err);
@@ -902,7 +903,7 @@ static ssize_t status_show(struct device *dev, struct device_attribute *attr, ch
}
/* Calculate diagnostic status */
bool all_tests_pass = (status.executed > 0 && status.passed == status.executed);
all_tests_pass = (status.executed > 0 && status.passed == status.executed);
/* Print detailed status information for this ISP */
pos += sprintf(buf + pos,