:::::: :::::: Manual check reason: "low confidence static check warning: drivers/opp/core.c:901:23: warning: Parameter 'regulators' can be declared with const [constParameter]" ::::::
BCC: [email protected] CC: [email protected] CC: [email protected] TO: Viresh Kumar <[email protected]> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 15205c2829ca2cbb5ece5ceaafe1171a8470e62b commit: c522ce8a08066b44539e0dd0998b8e3b277a759b OPP: Make _generic_set_opp_regulator() a config_regulators() interface date: 5 weeks ago :::::: branch date: 6 hours ago :::::: commit date: 5 weeks ago compiler: sparc64-linux-gcc (GCC) 12.1.0 reproduce (cppcheck warning): # apt-get install cppcheck git checkout c522ce8a08066b44539e0dd0998b8e3b277a759b 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 <[email protected]> cppcheck possible warnings: (new ones prefixed by >>, may not real problems) >> drivers/opp/core.c:901:23: warning: Parameter 'regulators' can be declared >> with const [constParameter] struct regulator **regulators, unsigned int count) ^ drivers/opp/core.c:2636:27: warning: Parameter 'src_opp' can be declared with const [constParameter] struct dev_pm_opp *src_opp) ^ drivers/opp/core.c:64: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.clk_configured, opp_table.clk, opp_table.config_regulators, 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:369:12: warning: Uninitialized variable: opp->available [uninitvar] if (opp->available) ^ drivers/opp/core.c:446:17: warning: Uninitialized variable: temp_opp->available [uninitvar] if (temp_opp->available == available && ^ drivers/opp/core.c:436:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:446:17: note: Uninitialized variable: temp_opp->available if (temp_opp->available == available && ^ drivers/opp/core.c:471:17: warning: Uninitialized variable: temp_opp->available [uninitvar] if (temp_opp->available && temp_opp->rate >= *freq) { ^ drivers/opp/core.c:671:17: warning: Uninitialized variable: temp_opp->level [uninitvar] if (temp_opp->level == level) { ^ drivers/opp/core.c:661:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:671:17: note: Uninitialized variable: temp_opp->level if (temp_opp->level == level) { ^ drivers/opp/core.c:719:17: warning: Uninitialized variable: temp_opp->available [uninitvar] if (temp_opp->available && temp_opp->level >= *level) { ^ drivers/opp/core.c:709:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:719:17: note: Uninitialized variable: temp_opp->available if (temp_opp->available && temp_opp->level >= *level) { ^ drivers/opp/core.c:1614:13: warning: Uninitialized variable: iter->rate [uninitvar] if (iter->rate == freq) { ^ drivers/opp/core.c:1608:12: note: Assuming condition is false if (IS_ERR(opp_table)) ^ drivers/opp/core.c:1614:13: note: Uninitialized variable: iter->rate if (iter->rate == freq) { ^ drivers/opp/core.c:1648:14: warning: Uninitialized variable: temp->removed [uninitvar] if (!temp->removed && dynamic == temp->dynamic) { ^ drivers/opp/core.c:1796: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.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:2808:16: warning: Uninitialized variable: tmp_opp->rate [uninitvar] if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:2798:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:2808:16: note: Uninitialized variable: tmp_opp->rate if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:2879:16: warning: Uninitialized variable: tmp_opp->rate [uninitvar] if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:2869:12: note: Assuming condition is false if (IS_ERR(opp_table)) { ^ drivers/opp/core.c:2879:16: note: Uninitialized variable: tmp_opp->rate if (tmp_opp->rate == freq) { ^ drivers/opp/core.c:64: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.clk_configured, opp_table.clk, opp_table.config_regulators, 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:1796: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.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 +/regulators +901 drivers/opp/core.c 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 898 c522ce8a08066b drivers/opp/core.c Viresh Kumar 2022-05-31 899 static int _opp_config_regulator_single(struct device *dev, c522ce8a08066b drivers/opp/core.c Viresh Kumar 2022-05-31 900 struct dev_pm_opp *old_opp, struct dev_pm_opp *new_opp, c522ce8a08066b drivers/opp/core.c Viresh Kumar 2022-05-31 @901 struct regulator **regulators, unsigned int count) 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 902 { c522ce8a08066b drivers/opp/core.c Viresh Kumar 2022-05-31 903 struct regulator *reg = regulators[0]; 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 904 int ret; 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 905 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 906 /* This function only supports single regulator per device */ c522ce8a08066b drivers/opp/core.c Viresh Kumar 2022-05-31 907 if (WARN_ON(count > 1)) { 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 908 dev_err(dev, "multiple regulators are not supported\n"); 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 909 return -EINVAL; 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 910 } 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 911 c522ce8a08066b drivers/opp/core.c Viresh Kumar 2022-05-31 912 ret = _set_opp_voltage(dev, reg, new_opp->supplies); 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 913 if (ret) c522ce8a08066b drivers/opp/core.c Viresh Kumar 2022-05-31 914 return ret; 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 915 8d45719caaf56c drivers/opp/core.c Kamil Konieczny 2019-07-19 916 /* 8d45719caaf56c drivers/opp/core.c Kamil Konieczny 2019-07-19 917 * Enable the regulator after setting its voltages, otherwise it breaks 8d45719caaf56c drivers/opp/core.c Kamil Konieczny 2019-07-19 918 * some boot-enabled regulators. 8d45719caaf56c drivers/opp/core.c Kamil Konieczny 2019-07-19 919 */ c522ce8a08066b drivers/opp/core.c Viresh Kumar 2022-05-31 920 if (unlikely(!new_opp->opp_table->enabled)) { 8d45719caaf56c drivers/opp/core.c Kamil Konieczny 2019-07-19 921 ret = regulator_enable(reg); 8d45719caaf56c drivers/opp/core.c Kamil Konieczny 2019-07-19 922 if (ret < 0) 8d45719caaf56c drivers/opp/core.c Kamil Konieczny 2019-07-19 923 dev_warn(dev, "Failed to enable regulator: %d", ret); 8d45719caaf56c drivers/opp/core.c Kamil Konieczny 2019-07-19 924 } 8d45719caaf56c drivers/opp/core.c Kamil Konieczny 2019-07-19 925 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 926 return 0; 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 927 } 947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 928 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
