On Mon, 10 Feb 2025 09:46:45 +0800
Bingbin Chen <[email protected]> wrote:
> +
> +static void
> +zxdh_np_fw_version_data_read(uint64_t compatible_base_addr,
> + ZXDH_VERSION_COMPATIBLE_REG_T *p_fw_version_data,
> uint32_t module_id)
> +{
> + void *fw_addr = NULL;
> + uint64_t module_compatible_addr = 0;
Why do you initialize variables then set then in the next statement.
Sure the compiler will optimize away the waste, but not good style.
> +
> + module_compatible_addr = compatible_base_addr +
> + sizeof(ZXDH_VERSION_COMPATIBLE_REG_T) * (module_id - 1);
> +
> + fw_addr = (void *)module_compatible_addr;
You could skip the temporary variable here and just put cast in the memcpy.
> +
> + rte_memcpy(p_fw_version_data, fw_addr,
> sizeof(ZXDH_VERSION_COMPATIBLE_REG_T));
> +}
We want to get rid of rte_memcpy(), only use it where it is performance
sensitive
and variable size.