CC: [email protected] BCC: [email protected] CC: [email protected] TO: Krzysztof Kozlowski <[email protected]>
tree: https://github.com/krzk/linux n/qcom-ufs-opp-v3 head: 00fbe567c9dc48a8d0c625f3955587a7a21aca8e commit: d7df0def3ee070b7c8f309eb1547e22d1ea6c343 [15/16] PM: opp: parse multiple frequencies in each OPP :::::: branch date: 4 days ago :::::: commit date: 4 days ago compiler: xtensa-linux-gcc (GCC) 11.3.0 reproduce (cppcheck warning): # apt-get install cppcheck git checkout d7df0def3ee070b7c8f309eb1547e22d1ea6c343 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:2736: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.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:377:12: warning: Uninitialized variable: opp->available [uninitvar] if (opp->available) ^ drivers/opp/core.c:454:17: warning: Uninitialized variable: temp_opp->available [uninitvar] if (temp_opp->available == available && ^ drivers/opp/core.c:444:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:454:17: note: Uninitialized variable: temp_opp->available if (temp_opp->available == available && ^ drivers/opp/core.c:479:17: warning: Uninitialized variable: temp_opp->available [uninitvar] if (temp_opp->available && temp_opp->rate >= *freq) { ^ drivers/opp/core.c:679:17: warning: Uninitialized variable: temp_opp->level [uninitvar] if (temp_opp->level == level) { ^ drivers/opp/core.c:669:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:679:17: note: Uninitialized variable: temp_opp->level if (temp_opp->level == level) { ^ drivers/opp/core.c:727:17: warning: Uninitialized variable: temp_opp->available [uninitvar] if (temp_opp->available && temp_opp->level >= *level) { ^ drivers/opp/core.c:717:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:727:17: note: Uninitialized variable: temp_opp->available if (temp_opp->available && temp_opp->level >= *level) { ^ drivers/opp/core.c:1664:13: warning: Uninitialized variable: iter->rate [uninitvar] if (iter->rate == freq) { ^ drivers/opp/core.c:1658:12: note: Assuming condition is false if (IS_ERR(opp_table)) ^ drivers/opp/core.c:1664:13: note: Uninitialized variable: iter->rate if (iter->rate == freq) { ^ drivers/opp/core.c:1698:14: warning: Uninitialized variable: temp->removed [uninitvar] if (!temp->removed && dynamic == temp->dynamic) { ^ >> drivers/opp/core.c:1852: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.supplies, opp.rates, 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:2909:16: warning: Uninitialized variable: tmp_opp->rate [uninitvar] if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:2899:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:2909:16: note: Uninitialized variable: tmp_opp->rate if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:2980:16: warning: Uninitialized variable: tmp_opp->rate [uninitvar] if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:2970:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:2980: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.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:1852: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.supplies, opp.rates, 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 +1852 drivers/opp/core.c 6c591eec67cbb4 drivers/opp/core.c Saravana Kannan 2020-05-12 1835 a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1836 static int _opp_is_duplicate(struct device *dev, struct dev_pm_opp *new_opp, a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1837 struct opp_table *opp_table, a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1838 struct list_head **head) 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1839 { 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1840 struct dev_pm_opp *opp; 6c591eec67cbb4 drivers/opp/core.c Saravana Kannan 2020-05-12 1841 int opp_cmp; 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1842 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1843 /* 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1844 * Insert new OPP in order of increasing frequency and discard if 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1845 * already present. 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1846 * 2c2709dc6921c5 drivers/base/power/opp/core.c Viresh Kumar 2016-02-16 1847 * Need to use &opp_table->opp_list in the condition part of the 'for' 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1848 * loop, don't replace it with head otherwise it will become an infinite 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1849 * loop. 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1850 */ 052c6f19141dd1 drivers/base/power/opp/core.c Viresh Kumar 2017-01-23 1851 list_for_each_entry(opp, &opp_table->opp_list, node) { 6c591eec67cbb4 drivers/opp/core.c Saravana Kannan 2020-05-12 @1852 opp_cmp = _opp_compare_key(new_opp, opp); 6c591eec67cbb4 drivers/opp/core.c Saravana Kannan 2020-05-12 1853 if (opp_cmp > 0) { a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1854 *head = &opp->node; 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1855 continue; 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1856 } 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1857 6c591eec67cbb4 drivers/opp/core.c Saravana Kannan 2020-05-12 1858 if (opp_cmp < 0) a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1859 return 0; 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1860 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1861 /* Duplicate OPPs */ 064416586190cb drivers/base/power/opp.c Viresh Kumar 2015-07-29 1862 dev_warn(dev, "%s: duplicate OPPs detected. Existing: freq: %lu, volt: %lu, enabled: %d. New: freq: %lu, volt: %lu, enabled: %d\n", dfbe4678d709e2 drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1863 __func__, opp->rate, opp->supplies[0].u_volt, dfbe4678d709e2 drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1864 opp->available, new_opp->rate, dfbe4678d709e2 drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1865 new_opp->supplies[0].u_volt, new_opp->available); 23dacf6d2e9935 drivers/base/power/opp.c Viresh Kumar 2015-07-29 1866 dfbe4678d709e2 drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1867 /* Should we compare voltages for all regulators here ? */ a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1868 return opp->available && 7f8538ebaefc07 drivers/base/power/opp/core.c Viresh Kumar 2017-01-02 1869 new_opp->supplies[0].u_volt == opp->supplies[0].u_volt ? -EBUSY : -EEXIST; a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1870 } a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1871 a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1872 return 0; a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1873 } a1e8c13600bfd9 drivers/opp/core.c Viresh Kumar 2018-04-06 1874 :::::: The code at line 1852 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]
