From 833468b2920bb9fc7890a326a2bfdce4946da8b0 Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Mon, 1 Aug 2022 11:15:28 +0300 Subject: [PATCH] sinowealth: use a constant instead of a magic number --- src/driver-sinowealth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/driver-sinowealth.c b/src/driver-sinowealth.c index b8b5e2db..bd5f3c77 100644 --- a/src/driver-sinowealth.c +++ b/src/driver-sinowealth.c @@ -87,6 +87,8 @@ _Static_assert(sizeof(enum sinowealth_command_id) == sizeof(uint8_t), "Invalid s /* Maximum amount of real events in a macro. */ #define SINOWEALTH_MACRO_LENGTH_MAX 168 +#define SINOWEALTH_FW_VERSION_LEN 4 + /* Bit mask for @ref sinowealth_config_report.config. * * This naming may be incorrect as it's not actually known what the other bits do. @@ -1527,7 +1529,7 @@ sinowealth_init_profile(struct ratbag_device *device) */ struct sinowealth_config_report *config = &drv_data->configs[0]; - char fw_version[4]; + char fw_version[SINOWEALTH_FW_VERSION_LEN] = { 0 }; rc = sinowealth_get_fw_version(device, fw_version); if (rc) return rc;