From 53584a09208e670bb07347db116dc333ba5881a6 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Mon, 7 Apr 2025 11:16:33 +0100 Subject: [PATCH] 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 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3334920 Reviewed-by: Zhiyuan Wang GVS: buildbot_gerritrpt Reviewed-by: mobile promotions Reviewed-by: Mohit Ingale Tested-by: mobile promotions --- drivers/platform/tegra/rtcpu/camera-diagnostics.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/platform/tegra/rtcpu/camera-diagnostics.c b/drivers/platform/tegra/rtcpu/camera-diagnostics.c index 6b3f9569..d5b5cb1e 100644 --- a/drivers/platform/tegra/rtcpu/camera-diagnostics.c +++ b/drivers/platform/tegra/rtcpu/camera-diagnostics.c @@ -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,