pva: Fix mixed declarations and code

When building the PVA driver with the compiler option
'-Werror=declaration-after-statement' the build fails with the following
error ...

 drivers/video/tegra/host/pva/./src/kmd/common/pva_kmd_shared_buffer.c:
  In function ‘shared_buffer_process_msg’:
 drivers/video/tegra/host/pva/./src/kmd/common/pva_kmd_shared_buffer.c:
  error: ISO C90 forbids mixed declarations and code
  [-Werror=declaration-after-statement]
  187 |    uint32_t msg_size = safe_subu32(header.size, sizeof(header));
      |    ^~~~~~~~

Fix this build issue by ensuring the variable 'msg_size' is defined at
the start of the shared_buffer_process_msg() function.

Change-Id: Ibd4a51caae06bfda2e11dfc6e3f1cf2f26d618c7
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3330348
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mohnish Jain <mohnishj@nvidia.com>
Reviewed-by: Nan Wang <nanwa@nvidia.com>
This commit is contained in:
Jon Hunter
2025-03-27 13:36:23 +00:00
parent 838bb12196
commit 7a6b9bbadb

View File

@@ -179,12 +179,13 @@ static void shared_buffer_process_msg(struct pva_kmd_device *pva,
struct pva_kmd_fw_msg_res_unreg unreg_data;
struct pva_kmd_context *ctx = NULL;
void *msg_body;
uint32_t msg_size;
ASSERT(msg != NULL);
// Copy the header
memcpy(&header, msg, sizeof(header));
uint32_t msg_size = safe_subu32(header.size, sizeof(header));
msg_size = safe_subu32(header.size, sizeof(header));
msg_body = (uint8_t *)msg + sizeof(header);
switch (header.type) {