CC: [email protected] BCC: [email protected] CC: [email protected] TO: Krzysztof Kozlowski <[email protected]>
tree: https://github.com/krzk/linux n/qcom-ufs-opp-v2 head: a75f8b79ea63e60950b6a52fdab3564d90b42839 commit: a67d7c4895d92ab2c8327828551caae31c061472 [14/16] PM wip :::::: branch date: 16 hours ago :::::: commit date: 16 hours ago compiler: sparc64-linux-gcc (GCC) 11.2.0 reproduce (cppcheck warning): # apt-get install cppcheck git checkout a67d7c4895d92ab2c8327828551caae31c061472 cppcheck --quiet --enable=style,performance,portability --template=gcc FILE If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> cppcheck possible warnings: (new ones prefixed by >>, may not real problems) drivers/opp/core.c:2625:27: warning: Parameter 'src_opp' can be declared with const [constParameter] struct dev_pm_opp *src_opp) ^ drivers/opp/core.c:60:26: warning: Uninitialized variables: opp_table.node, opp_table.lazy, opp_table.head, opp_table.dev_list, opp_table.opp_list, opp_table.kref, opp_table.lock, opp_table.np, opp_table.clock_latency_ns_max, opp_table.voltage_tolerance_v1, opp_table.parsed_static_opps, opp_table.shared_opp, opp_table.version, opp_table.current_rate, opp_table.current_opp, opp_table.suspend_opp, opp_table.genpd_virt_dev_lock, opp_table.genpd_virt_devs, opp_table.required_opp_tables, opp_table.required_opp_count, opp_table.supported_hw, opp_table.supported_hw_count, opp_table.prop_name, opp_table.clks, opp_table.clk_count, opp_table.regulators, opp_table.regulator_count, opp_table.paths, opp_table.path_count, opp_table.enabled, opp_table.genpd_performance_state, opp_table.is_genpd, opp_table.set_opp, opp_table.sod_supplies, opp_table.set_opp_data [uninitvar] if (_find_opp_dev(dev, opp_table)) { ^ drivers/opp/core.c:380:12: warning: Uninitialized variable: opp->available [uninitvar] if (opp->available) ^ drivers/opp/core.c:457:17: warning: Uninitialized variable: temp_opp->available [uninitvar] if (temp_opp->available == available && ^ drivers/opp/core.c:447:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:457:17: note: Uninitialized variable: temp_opp->available if (temp_opp->available == available && ^ drivers/opp/core.c:506:17: warning: Uninitialized variable: temp_opp->level [uninitvar] if (temp_opp->level == level) { ^ drivers/opp/core.c:496:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:506:17: note: Uninitialized variable: temp_opp->level if (temp_opp->level == level) { ^ drivers/opp/core.c:554:17: warning: Uninitialized variable: temp_opp->available [uninitvar] if (temp_opp->available && temp_opp->level >= *level) { ^ drivers/opp/core.c:544:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:554:17: note: Uninitialized variable: temp_opp->available if (temp_opp->available && temp_opp->level >= *level) { ^ drivers/opp/core.c:579:17: warning: Uninitialized variable: temp_opp->available [uninitvar] if (temp_opp->available && temp_opp->rate >= *freq) { ^ drivers/opp/core.c:1558:12: warning: Uninitialized variable: opp->rate [uninitvar] if (opp->rate == freq) { ^ drivers/opp/core.c:1552:12: note: Assuming condition is false if (IS_ERR(opp_table)) ^ drivers/opp/core.c:1558:12: note: Uninitialized variable: opp->rate if (opp->rate == freq) { ^ drivers/opp/core.c:1592:14: warning: Uninitialized variable: temp->removed [uninitvar] if (!temp->removed && dynamic == temp->dynamic) { ^ >> drivers/opp/core.c:1740:39: warning: Uninitialized variables: opp.node, >> opp.kref, opp.available, opp.dynamic, opp.turbo, opp.suspend, opp.removed, >> opp.pstate, opp.rate, opp.level, opp.rates, opp.supplies, opp.bandwidth, >> opp.clock_latency_ns, opp.required_opps, opp.opp_table, opp.np [uninitvar] opp_cmp = _opp_compare_key(new_opp, opp); ^ drivers/opp/core.c:2798:16: warning: Uninitialized variable: tmp_opp->rate [uninitvar] if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:2788:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:2798:16: note: Uninitialized variable: tmp_opp->rate if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:2869:16: warning: Uninitialized variable: tmp_opp->rate [uninitvar] if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:2859:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:2869:16: note: Uninitialized variable: tmp_opp->rate if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:60:26: warning: Uninitialized variables: opp_table.node, opp_table.lazy, opp_table.head, opp_table.dev_list, opp_table.opp_list, opp_table.kref, opp_table.lock, opp_table.np, opp_table.clock_latency_ns_max, opp_table.voltage_tolerance_v1, opp_table.parsed_static_opps, opp_table.shared_opp, opp_table.version, opp_table.current_rate, opp_table.current_opp, opp_table.suspend_opp, opp_table.genpd_virt_dev_lock, opp_table.genpd_virt_devs, opp_table.required_opp_tables, opp_table.required_opp_count, opp_table.supported_hw, opp_table.supported_hw_count, opp_table.prop_name, opp_table.clks, opp_table.clk_count, opp_table.regulators, opp_table.regulator_count, opp_table.paths, opp_table.path_count, opp_table.enabled, opp_table.genpd_performance_state, opp_table.is_genpd, opp_table.set_opp, opp_table.sod_supplies, opp_table.set_opp_data, opp_table.dentry [uninitvar] if (_find_opp_dev(dev, opp_table)) { ^ drivers/opp/core.c:1740:39: warning: Uninitialized variables: opp.node, opp.kref, opp.available, opp.dynamic, opp.turbo, opp.suspend, opp.removed, opp.pstate, opp.rate, opp.level, opp.rates, opp.supplies, opp.bandwidth, opp.clock_latency_ns, opp.required_opps, opp.opp_table, opp.np, opp.dentry, opp.of_name [uninitvar] opp_cmp = _opp_compare_key(new_opp, opp); ^ vim +1740 drivers/opp/core.c 6c591eec67cbb4d drivers/opp/core.c Saravana Kannan 2020-05-12 1723 a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1724 static int _opp_is_duplicate(struct device *dev, struct dev_pm_opp *new_opp, a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1725 struct opp_table *opp_table, a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1726 struct list_head **head) 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1727 { 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1728 struct dev_pm_opp *opp; 6c591eec67cbb4d drivers/opp/core.c Saravana Kannan 2020-05-12 1729 int opp_cmp; 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1730 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1731 /* 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1732 * Insert new OPP in order of increasing frequency and discard if 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1733 * already present. 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1734 * 2c2709dc6921c5d drivers/base/power/opp/core.c Viresh Kumar 2016-02-16 1735 * Need to use &opp_table->opp_list in the condition part of the 'for' 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1736 * loop, don't replace it with head otherwise it will become an infinite 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1737 * loop. 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1738 */ 052c6f19141dd13 drivers/base/power/opp/core.c Viresh Kumar 2017-01-23 1739 list_for_each_entry(opp, &opp_table->opp_list, node) { 6c591eec67cbb4d drivers/opp/core.c Saravana Kannan 2020-05-12 @1740 opp_cmp = _opp_compare_key(new_opp, opp); 6c591eec67cbb4d drivers/opp/core.c Saravana Kannan 2020-05-12 1741 if (opp_cmp > 0) { a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1742 *head = &opp->node; 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1743 continue; 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1744 } 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1745 6c591eec67cbb4d drivers/opp/core.c Saravana Kannan 2020-05-12 1746 if (opp_cmp < 0) a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1747 return 0; 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1748 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1749 /* Duplicate OPPs */ 064416586190cb0 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1750 dev_warn(dev, "%s: duplicate OPPs detected. Existing: freq: %lu, volt: %lu, enabled: %d. New: freq: %lu, volt: %lu, enabled: %d\n", dfbe4678d709e25 drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1751 __func__, opp->rate, opp->supplies[0].u_volt, dfbe4678d709e25 drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1752 opp->available, new_opp->rate, dfbe4678d709e25 drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1753 new_opp->supplies[0].u_volt, new_opp->available); 23dacf6d2e99355 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1754 dfbe4678d709e25 drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1755 /* Should we compare voltages for all regulators here ? */ a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1756 return opp->available && 7f8538ebaefc075 drivers/base/power/opp/core.c Viresh Kumar 2017-01-02 1757 new_opp->supplies[0].u_volt == opp->supplies[0].u_volt ? -EBUSY : -EEXIST; a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1758 } a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1759 a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1760 return 0; a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1761 } a1e8c13600bfd96 drivers/opp/core.c Viresh Kumar 2018-04-06 1762 :::::: The code at line 1740 was first introduced by commit :::::: 6c591eec67cbb4db988ab35b944f5cf9013c0714 OPP: Add helpers for reading the binding properties :::::: TO: Saravana Kannan <[email protected]> :::::: CC: Viresh Kumar <[email protected]> -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
