OSDN Git Service
input: vl53L0: Fix uninitialized variables
Clang warns:
drivers/input/misc/vl53L0/src/vl53l010_api.c:1425:3: error:
variable 'Temp8' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
VL53L010_GETARRAYPARAMETERFIELD(Dev, LimitChecksEnable,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/input/misc/vl53L0/src/vl53l010_api.c:87:7: note: expanded
from macro 'VL53L010_GETARRAYPARAMETERFIELD'
if (Status == VL53L0_ERROR_NONE) { \
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/input/misc/vl53L0/src/vl53l010_api.c:1427:24: note:
uninitialized use occurs here
*pLimitCheckEnable = Temp8;
^~~~~
drivers/input/misc/vl53L0/src/vl53l010_api.c:1425:3: note: remove
the 'if' if its condition is always true
VL53L010_GETARRAYPARAMETERFIELD(Dev, LimitChecksEnable,
^
drivers/input/misc/vl53L0/src/vl53l010_api.c:87:3: note: expanded
from macro 'VL53L010_GETARRAYPARAMETERFIELD'
if (Status == VL53L0_ERROR_NONE) { \
^
drivers/input/misc/vl53L0/src/vl53l010_api.c:1418:15: note:
initialize the variable 'Temp8' to silence this warning
uint8_t Temp8;
^
= '\0'
drivers/input/misc/vl53L0/src/vl53l010_api.c:3875:2: error:
variable 'xTalkCompRate_mcps' is used uninitialized whenever 'if'
condition is false [-Werror,-Wsometimes-uninitialized]
VL53L010_GETPARAMETERFIELD(Dev, XTalkCompensationRateMegaCps,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/input/misc/vl53L0/src/vl53l010_api.c:78:7: note: expanded
from macro 'VL53L010_GETPARAMETERFIELD'
if (Status == VL53L0_ERROR_NONE) { \
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/input/misc/vl53L0/src/vl53l010_api.c:3882:23: note:
uninitialized use occurs here
xTalkCompRate_kcps = xTalkCompRate_mcps * 1000;
^~~~~~~~~~~~~~~~~~
drivers/input/misc/vl53L0/src/vl53l010_api.c:3875:2: note: remove
the 'if' if its condition is always true
VL53L010_GETPARAMETERFIELD(Dev, XTalkCompensationRateMegaCps,
^
drivers/input/misc/vl53L0/src/vl53l010_api.c:78:3: note: expanded
from macro 'VL53L010_GETPARAMETERFIELD'
if (Status == VL53L0_ERROR_NONE) { \
^
drivers/input/misc/vl53L0/src/vl53l010_api.c:3844:35: note:
initialize the variable 'xTalkCompRate_mcps' to silence this warning
FixPoint1616_t xTalkCompRate_mcps;
^
= 0
2 errors generated.