* drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
@ 2022-11-19 13:43 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-11-19 13:43 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "low confidence static check warning: drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Daniel Lezcano <daniel.lezcano@linaro.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fe24a97cf2543e8832e7a2124802e5c32aac05aa
commit: a930da9bf583b2add01fb0e086913664dadaffd0 thermal/core: Move the mutex inside the thermal_zone_device_update() function
date: 3 months ago
:::::: branch date: 12 hours ago
:::::: commit date: 3 months ago
compiler: mips-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout a930da9bf583b2add01fb0e086913664dadaffd0
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
ret = tz->ops->get_temp(tz, temp);
^
drivers/thermal/thermal_helpers.c:69:10: note: ret is initialized
int ret = -EINVAL;
^
drivers/thermal/thermal_helpers.c:79:6: note: ret is overwritten
ret = tz->ops->get_temp(tz, temp);
^
vim +/ret +79 drivers/thermal/thermal_helpers.c
cd221c7b638f83 Eduardo Valentin 2016-11-07 66
a930da9bf583b2 Daniel Lezcano 2022-08-05 67 int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
cd221c7b638f83 Eduardo Valentin 2016-11-07 68 {
cd221c7b638f83 Eduardo Valentin 2016-11-07 69 int ret = -EINVAL;
cd221c7b638f83 Eduardo Valentin 2016-11-07 70 int count;
cd221c7b638f83 Eduardo Valentin 2016-11-07 71 int crit_temp = INT_MAX;
cd221c7b638f83 Eduardo Valentin 2016-11-07 72 enum thermal_trip_type type;
cd221c7b638f83 Eduardo Valentin 2016-11-07 73
a930da9bf583b2 Daniel Lezcano 2022-08-05 74 lockdep_assert_held(&tz->lock);
cd221c7b638f83 Eduardo Valentin 2016-11-07 75
a930da9bf583b2 Daniel Lezcano 2022-08-05 76 if (!tz || IS_ERR(tz) || !tz->ops->get_temp)
a930da9bf583b2 Daniel Lezcano 2022-08-05 77 return -EINVAL;
cd221c7b638f83 Eduardo Valentin 2016-11-07 78
cd221c7b638f83 Eduardo Valentin 2016-11-07 @79 ret = tz->ops->get_temp(tz, temp);
cd221c7b638f83 Eduardo Valentin 2016-11-07 80
cd221c7b638f83 Eduardo Valentin 2016-11-07 81 if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) {
e5bfcd30f88fdb Daniel Lezcano 2022-07-22 82 for (count = 0; count < tz->num_trips; count++) {
cd221c7b638f83 Eduardo Valentin 2016-11-07 83 ret = tz->ops->get_trip_type(tz, count, &type);
cd221c7b638f83 Eduardo Valentin 2016-11-07 84 if (!ret && type == THERMAL_TRIP_CRITICAL) {
cd221c7b638f83 Eduardo Valentin 2016-11-07 85 ret = tz->ops->get_trip_temp(tz, count,
cd221c7b638f83 Eduardo Valentin 2016-11-07 86 &crit_temp);
cd221c7b638f83 Eduardo Valentin 2016-11-07 87 break;
cd221c7b638f83 Eduardo Valentin 2016-11-07 88 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 89 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 90
cd221c7b638f83 Eduardo Valentin 2016-11-07 91 /*
cd221c7b638f83 Eduardo Valentin 2016-11-07 92 * Only allow emulating a temperature when the real temperature
cd221c7b638f83 Eduardo Valentin 2016-11-07 93 * is below the critical temperature so that the emulation code
cd221c7b638f83 Eduardo Valentin 2016-11-07 94 * cannot hide critical conditions.
cd221c7b638f83 Eduardo Valentin 2016-11-07 95 */
cd221c7b638f83 Eduardo Valentin 2016-11-07 96 if (!ret && *temp < crit_temp)
cd221c7b638f83 Eduardo Valentin 2016-11-07 97 *temp = tz->emul_temperature;
cd221c7b638f83 Eduardo Valentin 2016-11-07 98 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 99
cd221c7b638f83 Eduardo Valentin 2016-11-07 100 return ret;
cd221c7b638f83 Eduardo Valentin 2016-11-07 101 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 102
:::::: The code at line 79 was first introduced by commit
:::::: cd221c7b638f83193ffcacf9c2e3f087033fd4cf thermal: core: introduce thermal_helpers.c
:::::: TO: Eduardo Valentin <edubezval@gmail.com>
:::::: CC: Zhang Rui <rui.zhang@intel.com>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 5+ messages in thread
* drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
@ 2023-03-09 0:45 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2023-03-09 0:45 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "low confidence static check warning: drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Daniel Lezcano <daniel.lezcano@linaro.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6a98c9cae232800c319ed69e1063480d31430887
commit: a930da9bf583b2add01fb0e086913664dadaffd0 thermal/core: Move the mutex inside the thermal_zone_device_update() function
date: 7 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 7 months ago
compiler: sparc-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout a930da9bf583b2add01fb0e086913664dadaffd0
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/r/202303090839.k0ohgwT9-lkp@intel.com/
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
ret = tz->ops->get_temp(tz, temp);
^
drivers/thermal/thermal_helpers.c:69:10: note: ret is initialized
int ret = -EINVAL;
^
drivers/thermal/thermal_helpers.c:79:6: note: ret is overwritten
ret = tz->ops->get_temp(tz, temp);
^
vim +/ret +79 drivers/thermal/thermal_helpers.c
cd221c7b638f83 Eduardo Valentin 2016-11-07 66
a930da9bf583b2 Daniel Lezcano 2022-08-05 67 int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
cd221c7b638f83 Eduardo Valentin 2016-11-07 68 {
cd221c7b638f83 Eduardo Valentin 2016-11-07 69 int ret = -EINVAL;
cd221c7b638f83 Eduardo Valentin 2016-11-07 70 int count;
cd221c7b638f83 Eduardo Valentin 2016-11-07 71 int crit_temp = INT_MAX;
cd221c7b638f83 Eduardo Valentin 2016-11-07 72 enum thermal_trip_type type;
cd221c7b638f83 Eduardo Valentin 2016-11-07 73
a930da9bf583b2 Daniel Lezcano 2022-08-05 74 lockdep_assert_held(&tz->lock);
cd221c7b638f83 Eduardo Valentin 2016-11-07 75
a930da9bf583b2 Daniel Lezcano 2022-08-05 76 if (!tz || IS_ERR(tz) || !tz->ops->get_temp)
a930da9bf583b2 Daniel Lezcano 2022-08-05 77 return -EINVAL;
cd221c7b638f83 Eduardo Valentin 2016-11-07 78
cd221c7b638f83 Eduardo Valentin 2016-11-07 @79 ret = tz->ops->get_temp(tz, temp);
cd221c7b638f83 Eduardo Valentin 2016-11-07 80
cd221c7b638f83 Eduardo Valentin 2016-11-07 81 if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) {
e5bfcd30f88fdb Daniel Lezcano 2022-07-22 82 for (count = 0; count < tz->num_trips; count++) {
cd221c7b638f83 Eduardo Valentin 2016-11-07 83 ret = tz->ops->get_trip_type(tz, count, &type);
cd221c7b638f83 Eduardo Valentin 2016-11-07 84 if (!ret && type == THERMAL_TRIP_CRITICAL) {
cd221c7b638f83 Eduardo Valentin 2016-11-07 85 ret = tz->ops->get_trip_temp(tz, count,
cd221c7b638f83 Eduardo Valentin 2016-11-07 86 &crit_temp);
cd221c7b638f83 Eduardo Valentin 2016-11-07 87 break;
cd221c7b638f83 Eduardo Valentin 2016-11-07 88 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 89 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 90
cd221c7b638f83 Eduardo Valentin 2016-11-07 91 /*
cd221c7b638f83 Eduardo Valentin 2016-11-07 92 * Only allow emulating a temperature when the real temperature
cd221c7b638f83 Eduardo Valentin 2016-11-07 93 * is below the critical temperature so that the emulation code
cd221c7b638f83 Eduardo Valentin 2016-11-07 94 * cannot hide critical conditions.
cd221c7b638f83 Eduardo Valentin 2016-11-07 95 */
cd221c7b638f83 Eduardo Valentin 2016-11-07 96 if (!ret && *temp < crit_temp)
cd221c7b638f83 Eduardo Valentin 2016-11-07 97 *temp = tz->emul_temperature;
cd221c7b638f83 Eduardo Valentin 2016-11-07 98 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 99
cd221c7b638f83 Eduardo Valentin 2016-11-07 100 return ret;
cd221c7b638f83 Eduardo Valentin 2016-11-07 101 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 102
:::::: The code at line 79 was first introduced by commit
:::::: cd221c7b638f83193ffcacf9c2e3f087033fd4cf thermal: core: introduce thermal_helpers.c
:::::: TO: Eduardo Valentin <edubezval@gmail.com>
:::::: CC: Zhang Rui <rui.zhang@intel.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 5+ messages in thread
* drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
@ 2023-03-05 15:17 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2023-03-05 15:17 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "low confidence static check warning: drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Daniel Lezcano <daniel.lezcano@linaro.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b01fe98d34f3bed944a93bd8119fed80c856fad8
commit: a930da9bf583b2add01fb0e086913664dadaffd0 thermal/core: Move the mutex inside the thermal_zone_device_update() function
date: 7 months ago
:::::: branch date: 16 hours ago
:::::: commit date: 7 months ago
compiler: sh4-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout a930da9bf583b2add01fb0e086913664dadaffd0
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/r/202303052339.igee5PrW-lkp@intel.com/
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
ret = tz->ops->get_temp(tz, temp);
^
drivers/thermal/thermal_helpers.c:69:10: note: ret is initialized
int ret = -EINVAL;
^
drivers/thermal/thermal_helpers.c:79:6: note: ret is overwritten
ret = tz->ops->get_temp(tz, temp);
^
vim +/ret +79 drivers/thermal/thermal_helpers.c
cd221c7b638f83 Eduardo Valentin 2016-11-07 66
a930da9bf583b2 Daniel Lezcano 2022-08-05 67 int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
cd221c7b638f83 Eduardo Valentin 2016-11-07 68 {
cd221c7b638f83 Eduardo Valentin 2016-11-07 69 int ret = -EINVAL;
cd221c7b638f83 Eduardo Valentin 2016-11-07 70 int count;
cd221c7b638f83 Eduardo Valentin 2016-11-07 71 int crit_temp = INT_MAX;
cd221c7b638f83 Eduardo Valentin 2016-11-07 72 enum thermal_trip_type type;
cd221c7b638f83 Eduardo Valentin 2016-11-07 73
a930da9bf583b2 Daniel Lezcano 2022-08-05 74 lockdep_assert_held(&tz->lock);
cd221c7b638f83 Eduardo Valentin 2016-11-07 75
a930da9bf583b2 Daniel Lezcano 2022-08-05 76 if (!tz || IS_ERR(tz) || !tz->ops->get_temp)
a930da9bf583b2 Daniel Lezcano 2022-08-05 77 return -EINVAL;
cd221c7b638f83 Eduardo Valentin 2016-11-07 78
cd221c7b638f83 Eduardo Valentin 2016-11-07 @79 ret = tz->ops->get_temp(tz, temp);
cd221c7b638f83 Eduardo Valentin 2016-11-07 80
cd221c7b638f83 Eduardo Valentin 2016-11-07 81 if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) {
e5bfcd30f88fdb Daniel Lezcano 2022-07-22 82 for (count = 0; count < tz->num_trips; count++) {
cd221c7b638f83 Eduardo Valentin 2016-11-07 83 ret = tz->ops->get_trip_type(tz, count, &type);
cd221c7b638f83 Eduardo Valentin 2016-11-07 84 if (!ret && type == THERMAL_TRIP_CRITICAL) {
cd221c7b638f83 Eduardo Valentin 2016-11-07 85 ret = tz->ops->get_trip_temp(tz, count,
cd221c7b638f83 Eduardo Valentin 2016-11-07 86 &crit_temp);
cd221c7b638f83 Eduardo Valentin 2016-11-07 87 break;
cd221c7b638f83 Eduardo Valentin 2016-11-07 88 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 89 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 90
cd221c7b638f83 Eduardo Valentin 2016-11-07 91 /*
cd221c7b638f83 Eduardo Valentin 2016-11-07 92 * Only allow emulating a temperature when the real temperature
cd221c7b638f83 Eduardo Valentin 2016-11-07 93 * is below the critical temperature so that the emulation code
cd221c7b638f83 Eduardo Valentin 2016-11-07 94 * cannot hide critical conditions.
cd221c7b638f83 Eduardo Valentin 2016-11-07 95 */
cd221c7b638f83 Eduardo Valentin 2016-11-07 96 if (!ret && *temp < crit_temp)
cd221c7b638f83 Eduardo Valentin 2016-11-07 97 *temp = tz->emul_temperature;
cd221c7b638f83 Eduardo Valentin 2016-11-07 98 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 99
cd221c7b638f83 Eduardo Valentin 2016-11-07 100 return ret;
cd221c7b638f83 Eduardo Valentin 2016-11-07 101 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 102
:::::: The code at line 79 was first introduced by commit
:::::: cd221c7b638f83193ffcacf9c2e3f087033fd4cf thermal: core: introduce thermal_helpers.c
:::::: TO: Eduardo Valentin <edubezval@gmail.com>
:::::: CC: Zhang Rui <rui.zhang@intel.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 5+ messages in thread
* drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
@ 2023-02-02 10:24 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2023-02-02 10:24 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "low confidence static check warning: drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Daniel Lezcano <daniel.lezcano@linaro.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9f266ccaa2f5228bfe67ad58a94ca4e0109b954a
commit: a930da9bf583b2add01fb0e086913664dadaffd0 thermal/core: Move the mutex inside the thermal_zone_device_update() function
date: 6 months ago
:::::: branch date: 16 hours ago
:::::: commit date: 6 months ago
compiler: arc-elf-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout a930da9bf583b2add01fb0e086913664dadaffd0
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> drivers/thermal/thermal_sysfs.c:620:6: warning: %ld in format string (no. 1) requires 'long *' but the argument type is 'unsigned long *'. [invalidScanfArgType_int]
if (sscanf(buf, "%ldn", &state) != 1)
^
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
ret = tz->ops->get_temp(tz, temp);
^
drivers/thermal/thermal_helpers.c:69:10: note: ret is initialized
int ret = -EINVAL;
^
drivers/thermal/thermal_helpers.c:79:6: note: ret is overwritten
ret = tz->ops->get_temp(tz, temp);
^
drivers/thermal/thermal_of.c:146:27: warning: Parameter 'sensor_np' can be declared as pointer to const [constParameter]
struct device_node *sensor_np,
^
>> drivers/thermal/thermal_of.c:179:72: warning: Parameter 'trip' can be declared as pointer to const [constParameter]
static int of_find_trip_id(struct device_node *np, struct device_node *trip)
^
>> drivers/thermal/thermal_of.c:717:17: warning: Parameter 'data' can be declared as pointer to const [constParameter]
void *data)
^
--
>> drivers/thermal/thermal_sysfs.c:596:9: warning: %ld in format string (no. 1) requires 'long' but the argument type is 'unsigned long'. [invalidPrintfArgType_sint]
return sprintf(buf, "%ldn", state);
^
drivers/thermal/thermal_sysfs.c:609:9: warning: %ld in format string (no. 1) requires 'long' but the argument type is 'unsigned long'. [invalidPrintfArgType_sint]
return sprintf(buf, "%ldn", state);
^
>> drivers/thermal/thermal_sysfs.c:902:9: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
return sprintf(buf, "%dn", instance->weight);
^
>> drivers/thermal/thermal_sysfs.c:728:10: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint]
len += sprintf(buf + len, "state%ut%llun", i,
^
drivers/thermal/thermal_sysfs.c:772:10: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint]
len += snprintf(buf + len, PAGE_SIZE - len, "state%2u ", i);
^
drivers/thermal/thermal_sysfs.c:783:10: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint]
len += snprintf(buf + len, PAGE_SIZE - len, "state%2u:", i);
^
vim +/ret +79 drivers/thermal/thermal_helpers.c
cd221c7b638f83 Eduardo Valentin 2016-11-07 66
a930da9bf583b2 Daniel Lezcano 2022-08-05 67 int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
cd221c7b638f83 Eduardo Valentin 2016-11-07 68 {
cd221c7b638f83 Eduardo Valentin 2016-11-07 69 int ret = -EINVAL;
cd221c7b638f83 Eduardo Valentin 2016-11-07 70 int count;
cd221c7b638f83 Eduardo Valentin 2016-11-07 71 int crit_temp = INT_MAX;
cd221c7b638f83 Eduardo Valentin 2016-11-07 72 enum thermal_trip_type type;
cd221c7b638f83 Eduardo Valentin 2016-11-07 73
a930da9bf583b2 Daniel Lezcano 2022-08-05 74 lockdep_assert_held(&tz->lock);
cd221c7b638f83 Eduardo Valentin 2016-11-07 75
a930da9bf583b2 Daniel Lezcano 2022-08-05 76 if (!tz || IS_ERR(tz) || !tz->ops->get_temp)
a930da9bf583b2 Daniel Lezcano 2022-08-05 77 return -EINVAL;
cd221c7b638f83 Eduardo Valentin 2016-11-07 78
cd221c7b638f83 Eduardo Valentin 2016-11-07 @79 ret = tz->ops->get_temp(tz, temp);
cd221c7b638f83 Eduardo Valentin 2016-11-07 80
cd221c7b638f83 Eduardo Valentin 2016-11-07 81 if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) {
e5bfcd30f88fdb Daniel Lezcano 2022-07-22 82 for (count = 0; count < tz->num_trips; count++) {
cd221c7b638f83 Eduardo Valentin 2016-11-07 83 ret = tz->ops->get_trip_type(tz, count, &type);
cd221c7b638f83 Eduardo Valentin 2016-11-07 84 if (!ret && type == THERMAL_TRIP_CRITICAL) {
cd221c7b638f83 Eduardo Valentin 2016-11-07 85 ret = tz->ops->get_trip_temp(tz, count,
cd221c7b638f83 Eduardo Valentin 2016-11-07 86 &crit_temp);
cd221c7b638f83 Eduardo Valentin 2016-11-07 87 break;
cd221c7b638f83 Eduardo Valentin 2016-11-07 88 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 89 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 90
cd221c7b638f83 Eduardo Valentin 2016-11-07 91 /*
cd221c7b638f83 Eduardo Valentin 2016-11-07 92 * Only allow emulating a temperature when the real temperature
cd221c7b638f83 Eduardo Valentin 2016-11-07 93 * is below the critical temperature so that the emulation code
cd221c7b638f83 Eduardo Valentin 2016-11-07 94 * cannot hide critical conditions.
cd221c7b638f83 Eduardo Valentin 2016-11-07 95 */
cd221c7b638f83 Eduardo Valentin 2016-11-07 96 if (!ret && *temp < crit_temp)
cd221c7b638f83 Eduardo Valentin 2016-11-07 97 *temp = tz->emul_temperature;
cd221c7b638f83 Eduardo Valentin 2016-11-07 98 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 99
cd221c7b638f83 Eduardo Valentin 2016-11-07 100 return ret;
cd221c7b638f83 Eduardo Valentin 2016-11-07 101 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 102
:::::: The code at line 79 was first introduced by commit
:::::: cd221c7b638f83193ffcacf9c2e3f087033fd4cf thermal: core: introduce thermal_helpers.c
:::::: TO: Eduardo Valentin <edubezval@gmail.com>
:::::: CC: Zhang Rui <rui.zhang@intel.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 5+ messages in thread
* drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
@ 2023-01-13 5:45 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2023-01-13 5:45 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp
::::::
:::::: Manual check reason: "low confidence static check warning: drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]"
::::::
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Daniel Lezcano <daniel.lezcano@linaro.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d9fc1511728c15df49ff18e49a494d00f78b7cd4
commit: a930da9bf583b2add01fb0e086913664dadaffd0 thermal/core: Move the mutex inside the thermal_zone_device_update() function
date: 5 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 5 months ago
compiler: csky-linux-gcc (GCC) 12.1.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout a930da9bf583b2add01fb0e086913664dadaffd0
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> drivers/thermal/thermal_sysfs.c:620:6: warning: %ld in format string (no. 1) requires 'long *' but the argument type is 'unsigned long *'. [invalidScanfArgType_int]
if (sscanf(buf, "%ldn", &state) != 1)
^
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
ret = tz->ops->get_temp(tz, temp);
^
drivers/thermal/thermal_helpers.c:69:10: note: ret is initialized
int ret = -EINVAL;
^
drivers/thermal/thermal_helpers.c:79:6: note: ret is overwritten
ret = tz->ops->get_temp(tz, temp);
^
>> drivers/thermal/thermal_sysfs.c:596:9: warning: %ld in format string (no. 1) requires 'long' but the argument type is 'unsigned long'. [invalidPrintfArgType_sint]
return sprintf(buf, "%ldn", state);
^
drivers/thermal/thermal_sysfs.c:609:9: warning: %ld in format string (no. 1) requires 'long' but the argument type is 'unsigned long'. [invalidPrintfArgType_sint]
return sprintf(buf, "%ldn", state);
^
>> drivers/thermal/thermal_sysfs.c:902:9: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint]
return sprintf(buf, "%dn", instance->weight);
^
>> drivers/thermal/thermal_sysfs.c:728:10: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint]
len += sprintf(buf + len, "state%ut%llun", i,
^
drivers/thermal/thermal_sysfs.c:772:10: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint]
len += snprintf(buf + len, PAGE_SIZE - len, "state%2u ", i);
^
drivers/thermal/thermal_sysfs.c:783:10: warning: %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'. [invalidPrintfArgType_uint]
len += snprintf(buf + len, PAGE_SIZE - len, "state%2u:", i);
^
vim +/ret +79 drivers/thermal/thermal_helpers.c
cd221c7b638f83 Eduardo Valentin 2016-11-07 66
a930da9bf583b2 Daniel Lezcano 2022-08-05 67 int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
cd221c7b638f83 Eduardo Valentin 2016-11-07 68 {
cd221c7b638f83 Eduardo Valentin 2016-11-07 69 int ret = -EINVAL;
cd221c7b638f83 Eduardo Valentin 2016-11-07 70 int count;
cd221c7b638f83 Eduardo Valentin 2016-11-07 71 int crit_temp = INT_MAX;
cd221c7b638f83 Eduardo Valentin 2016-11-07 72 enum thermal_trip_type type;
cd221c7b638f83 Eduardo Valentin 2016-11-07 73
a930da9bf583b2 Daniel Lezcano 2022-08-05 74 lockdep_assert_held(&tz->lock);
cd221c7b638f83 Eduardo Valentin 2016-11-07 75
a930da9bf583b2 Daniel Lezcano 2022-08-05 76 if (!tz || IS_ERR(tz) || !tz->ops->get_temp)
a930da9bf583b2 Daniel Lezcano 2022-08-05 77 return -EINVAL;
cd221c7b638f83 Eduardo Valentin 2016-11-07 78
cd221c7b638f83 Eduardo Valentin 2016-11-07 @79 ret = tz->ops->get_temp(tz, temp);
cd221c7b638f83 Eduardo Valentin 2016-11-07 80
cd221c7b638f83 Eduardo Valentin 2016-11-07 81 if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) {
e5bfcd30f88fdb Daniel Lezcano 2022-07-22 82 for (count = 0; count < tz->num_trips; count++) {
cd221c7b638f83 Eduardo Valentin 2016-11-07 83 ret = tz->ops->get_trip_type(tz, count, &type);
cd221c7b638f83 Eduardo Valentin 2016-11-07 84 if (!ret && type == THERMAL_TRIP_CRITICAL) {
cd221c7b638f83 Eduardo Valentin 2016-11-07 85 ret = tz->ops->get_trip_temp(tz, count,
cd221c7b638f83 Eduardo Valentin 2016-11-07 86 &crit_temp);
cd221c7b638f83 Eduardo Valentin 2016-11-07 87 break;
cd221c7b638f83 Eduardo Valentin 2016-11-07 88 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 89 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 90
cd221c7b638f83 Eduardo Valentin 2016-11-07 91 /*
cd221c7b638f83 Eduardo Valentin 2016-11-07 92 * Only allow emulating a temperature when the real temperature
cd221c7b638f83 Eduardo Valentin 2016-11-07 93 * is below the critical temperature so that the emulation code
cd221c7b638f83 Eduardo Valentin 2016-11-07 94 * cannot hide critical conditions.
cd221c7b638f83 Eduardo Valentin 2016-11-07 95 */
cd221c7b638f83 Eduardo Valentin 2016-11-07 96 if (!ret && *temp < crit_temp)
cd221c7b638f83 Eduardo Valentin 2016-11-07 97 *temp = tz->emul_temperature;
cd221c7b638f83 Eduardo Valentin 2016-11-07 98 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 99
cd221c7b638f83 Eduardo Valentin 2016-11-07 100 return ret;
cd221c7b638f83 Eduardo Valentin 2016-11-07 101 }
cd221c7b638f83 Eduardo Valentin 2016-11-07 102
:::::: The code at line 79 was first introduced by commit
:::::: cd221c7b638f83193ffcacf9c2e3f087033fd4cf thermal: core: introduce thermal_helpers.c
:::::: TO: Eduardo Valentin <edubezval@gmail.com>
:::::: CC: Zhang Rui <rui.zhang@intel.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-03-09 0:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-19 13:43 drivers/thermal/thermal_helpers.c:79:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization] kernel test robot
2023-01-13 5:45 kernel test robot
2023-02-02 10:24 kernel test robot
2023-03-05 15:17 kernel test robot
2023-03-09 0:45 kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).