device: add explicit macro/variable unsigned suffix

add explicit unsigned suffix to 'Z_DEVICE_MAX_NAME_LEN' macro, matching
it to return type of sizeof (size_t), thus the comparison operator '<='
has the same essential types, complying with required [misra-c2012-10.4]
rule which states; Both operands of an operator in which the usual
arithmetic conversions are performed shall have the same essential type
category.

Found as a coding guideline violation (Rule 10.4) by static code
scanning tool.

Note: Tested on STM32L5 Nucleo-144 board (stm32l552xx).

Signed-off-by: ferar alashkar <ferar.alashkar@gmail.com>
This commit is contained in:
ferar alashkar 2023-05-26 16:35:16 -04:00 committed by Chris Friedt
parent ad0f2a697c
commit 8c32950de9

View file

@ -854,7 +854,7 @@ static inline bool z_impl_device_is_ready(const struct device *dev)
* The maximum length is set so that device_get_binding() can be used from
* userspace.
*/
#define Z_DEVICE_MAX_NAME_LEN 48
#define Z_DEVICE_MAX_NAME_LEN 48U
/**
* @brief Compile time check for device name length