* drivers/opp/core.c:1025:45: warning: Possible null pointer dereference: opp [nullPointer]
@ 2021-11-13 11:55 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-11-13 11:55 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 11865 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Viresh Kumar <viresh.kumar@linaro.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 66f4beaa6c1d28161f534471484b2daa2de1dce0
commit: f0b88fa45595254fa51427bd8ca321732e2eb73d opp: Allow _set_opp() to work for non-freq devices
date: 9 months ago
:::::: branch date: 15 hours ago
:::::: commit date: 9 months ago
compiler: h8300-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/opp/core.c:1025:45: warning: Possible null pointer dereference: opp [nullPointer]
__func__, old_freq, freq, old_opp->level, opp->level,
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1025:45: note: Null pointer dereference
__func__, old_freq, freq, old_opp->level, opp->level,
^
drivers/opp/core.c:1027:3: warning: Possible null pointer dereference: opp [nullPointer]
opp->bandwidth ? opp->bandwidth[0].peak : 0);
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1027:3: note: Null pointer dereference
opp->bandwidth ? opp->bandwidth[0].peak : 0);
^
>> drivers/opp/core.c:1590:20: warning: Possible null pointer dereference: opp2 [nullPointer]
if (opp1->rate != opp2->rate)
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1029:43: note: Calling function '_opp_compare_key', 2nd argument 'opp' value is 0
scaling_down = _opp_compare_key(old_opp, opp);
^
drivers/opp/core.c:1590:20: note: Null pointer dereference
if (opp1->rate != opp2->rate)
^
drivers/opp/core.c:1595:21: warning: Possible null pointer dereference: opp2 [nullPointer]
if (opp1->level != opp2->level)
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1029:43: note: Calling function '_opp_compare_key', 2nd argument 'opp' value is 0
scaling_down = _opp_compare_key(old_opp, opp);
^
drivers/opp/core.c:1595:21: note: Null pointer dereference
if (opp1->level != opp2->level)
^
drivers/opp/core.c:1618:4: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
*head = &opp->node;
^
vim +1025 drivers/opp/core.c
f3364e17d5716a drivers/opp/core.c Viresh Kumar 2020-08-13 1000
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1001 static int _set_opp(struct device *dev, struct opp_table *opp_table,
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1002 struct dev_pm_opp *opp, unsigned long freq)
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1003 {
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1004 struct dev_pm_opp *old_opp;
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1005 unsigned long old_freq;
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1006 int scaling_down, ret;
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1007
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1008 if (unlikely(!opp))
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1009 return _disable_opp_table(dev, opp_table);
aca48b61f96386 drivers/opp/core.c Rajendra Nayak 2020-04-08 1010
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1011 /* Find the currently set OPP if we don't know already */
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1012 if (unlikely(!opp_table->current_opp))
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1013 _find_current_opp(dev, opp_table);
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1014
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1015 old_opp = opp_table->current_opp;
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1016 old_freq = old_opp->rate;
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1017
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1018 /* Return early if nothing to do */
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1019 if (opp_table->enabled && old_opp == opp) {
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1020 dev_dbg(dev, "%s: OPPs are same, nothing to do\n", __func__);
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1021 return 0;
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1022 }
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1023
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1024 dev_dbg(dev, "%s: switching OPP: Freq %lu -> %lu Hz, Level %u -> %u, Bw %u -> %u\n",
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 @1025 __func__, old_freq, freq, old_opp->level, opp->level,
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1026 old_opp->bandwidth ? old_opp->bandwidth[0].peak : 0,
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1027 opp->bandwidth ? opp->bandwidth[0].peak : 0);
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1028
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1029 scaling_down = _opp_compare_key(old_opp, opp);
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1030 if (scaling_down == -1)
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1031 scaling_down = 0;
947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1032
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1033 /* Scaling up? Configure required OPPs before frequency */
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1034 if (!scaling_down) {
2c59138c22f17c drivers/opp/core.c Stephan Gerhold 2020-07-30 1035 ret = _set_required_opps(dev, opp_table, opp, true);
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1036 if (ret)
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1037 return ret;
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1038 }
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1039
7e535993fa4f67 drivers/opp/core.c Viresh Kumar 2018-06-12 1040 if (opp_table->set_opp) {
7e535993fa4f67 drivers/opp/core.c Viresh Kumar 2018-06-12 1041 ret = _set_opp_custom(opp_table, dev, old_freq, freq,
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1042 old_opp->supplies, opp->supplies);
7e535993fa4f67 drivers/opp/core.c Viresh Kumar 2018-06-12 1043 } else if (opp_table->regulators) {
c74b32fadc00f2 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1044 ret = _generic_set_opp_regulator(opp_table, dev, old_freq, freq,
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1045 old_opp->supplies,
c74b32fadc00f2 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1046 opp->supplies);
c74b32fadc00f2 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1047 } else {
947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1048 /* Only frequency scaling */
1d3c42cabbd351 drivers/opp/core.c Viresh Kumar 2021-01-20 1049 ret = _generic_set_opp_clk_only(dev, opp_table->clk, freq);
c74b32fadc00f2 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1050 }
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1051
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1052 /* Scaling down? Configure required OPPs after frequency */
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1053 if (!ret && scaling_down) {
2c59138c22f17c drivers/opp/core.c Stephan Gerhold 2020-07-30 1054 ret = _set_required_opps(dev, opp_table, opp, false);
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1055 if (ret)
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1056 dev_err(dev, "Failed to set required opps: %d\n", ret);
c74b32fadc00f2 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1057 }
052c6f19141dd1 drivers/base/power/opp/core.c Viresh Kumar 2017-01-23 1058
72f80ce4ef9b75 drivers/opp/core.c Viresh Kumar 2020-08-13 1059 if (!ret) {
b00e667a6d8b2b drivers/opp/core.c Viresh Kumar 2020-05-27 1060 ret = _set_opp_bw(opp_table, opp, dev, false);
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1061 if (!ret) {
72f80ce4ef9b75 drivers/opp/core.c Viresh Kumar 2020-08-13 1062 opp_table->enabled = true;
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1063 dev_pm_opp_put(old_opp);
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1064
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1065 /* Make sure current_opp doesn't get freed */
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1066 dev_pm_opp_get(opp);
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1067 opp_table->current_opp = opp;
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1068 }
72f80ce4ef9b75 drivers/opp/core.c Viresh Kumar 2020-08-13 1069 }
fe2af40250bfc3 drivers/opp/core.c Georgi Djakov 2020-05-12 1070
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1071 return ret;
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1072 }
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1073
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* drivers/opp/core.c:1025:45: warning: Possible null pointer dereference: opp [nullPointer]
@ 2021-10-26 13:09 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-10-26 13:09 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 11865 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Viresh Kumar <viresh.kumar@linaro.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3906fe9bb7f1a2c8667ae54e967dc8690824f4ea
commit: f0b88fa45595254fa51427bd8ca321732e2eb73d opp: Allow _set_opp() to work for non-freq devices
date: 9 months ago
:::::: branch date: 19 hours ago
:::::: commit date: 9 months ago
compiler: h8300-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/opp/core.c:1025:45: warning: Possible null pointer dereference: opp [nullPointer]
__func__, old_freq, freq, old_opp->level, opp->level,
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1025:45: note: Null pointer dereference
__func__, old_freq, freq, old_opp->level, opp->level,
^
drivers/opp/core.c:1027:3: warning: Possible null pointer dereference: opp [nullPointer]
opp->bandwidth ? opp->bandwidth[0].peak : 0);
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1027:3: note: Null pointer dereference
opp->bandwidth ? opp->bandwidth[0].peak : 0);
^
>> drivers/opp/core.c:1590:20: warning: Possible null pointer dereference: opp2 [nullPointer]
if (opp1->rate != opp2->rate)
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1029:43: note: Calling function '_opp_compare_key', 2nd argument 'opp' value is 0
scaling_down = _opp_compare_key(old_opp, opp);
^
drivers/opp/core.c:1590:20: note: Null pointer dereference
if (opp1->rate != opp2->rate)
^
drivers/opp/core.c:1595:21: warning: Possible null pointer dereference: opp2 [nullPointer]
if (opp1->level != opp2->level)
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1029:43: note: Calling function '_opp_compare_key', 2nd argument 'opp' value is 0
scaling_down = _opp_compare_key(old_opp, opp);
^
drivers/opp/core.c:1595:21: note: Null pointer dereference
if (opp1->level != opp2->level)
^
drivers/opp/core.c:1618:4: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
*head = &opp->node;
^
vim +1025 drivers/opp/core.c
f3364e17d5716a drivers/opp/core.c Viresh Kumar 2020-08-13 1000
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1001 static int _set_opp(struct device *dev, struct opp_table *opp_table,
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1002 struct dev_pm_opp *opp, unsigned long freq)
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1003 {
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1004 struct dev_pm_opp *old_opp;
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1005 unsigned long old_freq;
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1006 int scaling_down, ret;
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1007
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1008 if (unlikely(!opp))
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1009 return _disable_opp_table(dev, opp_table);
aca48b61f96386 drivers/opp/core.c Rajendra Nayak 2020-04-08 1010
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1011 /* Find the currently set OPP if we don't know already */
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1012 if (unlikely(!opp_table->current_opp))
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1013 _find_current_opp(dev, opp_table);
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1014
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1015 old_opp = opp_table->current_opp;
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1016 old_freq = old_opp->rate;
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1017
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1018 /* Return early if nothing to do */
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1019 if (opp_table->enabled && old_opp == opp) {
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1020 dev_dbg(dev, "%s: OPPs are same, nothing to do\n", __func__);
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1021 return 0;
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1022 }
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1023
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1024 dev_dbg(dev, "%s: switching OPP: Freq %lu -> %lu Hz, Level %u -> %u, Bw %u -> %u\n",
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 @1025 __func__, old_freq, freq, old_opp->level, opp->level,
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1026 old_opp->bandwidth ? old_opp->bandwidth[0].peak : 0,
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1027 opp->bandwidth ? opp->bandwidth[0].peak : 0);
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1028
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1029 scaling_down = _opp_compare_key(old_opp, opp);
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1030 if (scaling_down == -1)
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1031 scaling_down = 0;
947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1032
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1033 /* Scaling up? Configure required OPPs before frequency */
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1034 if (!scaling_down) {
2c59138c22f17c drivers/opp/core.c Stephan Gerhold 2020-07-30 1035 ret = _set_required_opps(dev, opp_table, opp, true);
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1036 if (ret)
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1037 return ret;
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1038 }
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1039
7e535993fa4f67 drivers/opp/core.c Viresh Kumar 2018-06-12 1040 if (opp_table->set_opp) {
7e535993fa4f67 drivers/opp/core.c Viresh Kumar 2018-06-12 1041 ret = _set_opp_custom(opp_table, dev, old_freq, freq,
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1042 old_opp->supplies, opp->supplies);
7e535993fa4f67 drivers/opp/core.c Viresh Kumar 2018-06-12 1043 } else if (opp_table->regulators) {
c74b32fadc00f2 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1044 ret = _generic_set_opp_regulator(opp_table, dev, old_freq, freq,
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1045 old_opp->supplies,
c74b32fadc00f2 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1046 opp->supplies);
c74b32fadc00f2 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1047 } else {
947355850fcb3b drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1048 /* Only frequency scaling */
1d3c42cabbd351 drivers/opp/core.c Viresh Kumar 2021-01-20 1049 ret = _generic_set_opp_clk_only(dev, opp_table->clk, freq);
c74b32fadc00f2 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1050 }
6a0712f6f199e7 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1051
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1052 /* Scaling down? Configure required OPPs after frequency */
f0b88fa4559525 drivers/opp/core.c Viresh Kumar 2021-01-21 1053 if (!ret && scaling_down) {
2c59138c22f17c drivers/opp/core.c Stephan Gerhold 2020-07-30 1054 ret = _set_required_opps(dev, opp_table, opp, false);
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1055 if (ret)
ca1b5d77b1c69d drivers/opp/core.c Viresh Kumar 2018-06-14 1056 dev_err(dev, "Failed to set required opps: %d\n", ret);
c74b32fadc00f2 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1057 }
052c6f19141dd1 drivers/base/power/opp/core.c Viresh Kumar 2017-01-23 1058
72f80ce4ef9b75 drivers/opp/core.c Viresh Kumar 2020-08-13 1059 if (!ret) {
b00e667a6d8b2b drivers/opp/core.c Viresh Kumar 2020-05-27 1060 ret = _set_opp_bw(opp_table, opp, dev, false);
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1061 if (!ret) {
72f80ce4ef9b75 drivers/opp/core.c Viresh Kumar 2020-08-13 1062 opp_table->enabled = true;
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1063 dev_pm_opp_put(old_opp);
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1064
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1065 /* Make sure current_opp doesn't get freed */
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1066 dev_pm_opp_get(opp);
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1067 opp_table->current_opp = opp;
81c4d8a3c41488 drivers/opp/core.c Viresh Kumar 2021-01-20 1068 }
72f80ce4ef9b75 drivers/opp/core.c Viresh Kumar 2020-08-13 1069 }
fe2af40250bfc3 drivers/opp/core.c Georgi Djakov 2020-05-12 1070
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1071 return ret;
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1072 }
386ba854d9f316 drivers/opp/core.c Viresh Kumar 2021-01-21 1073
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* drivers/opp/core.c:1025:45: warning: Possible null pointer dereference: opp [nullPointer]
@ 2021-10-02 22:26 kernel test robot
0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-10-02 22:26 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 11937 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Viresh Kumar <viresh.kumar@linaro.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
commit: f0b88fa45595254fa51427bd8ca321732e2eb73d opp: Allow _set_opp() to work for non-freq devices
date: 8 months ago
:::::: branch date: 3 days ago
:::::: commit date: 8 months ago
compiler: h8300-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> drivers/opp/core.c:1025:45: warning: Possible null pointer dereference: opp [nullPointer]
__func__, old_freq, freq, old_opp->level, opp->level,
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1025:45: note: Null pointer dereference
__func__, old_freq, freq, old_opp->level, opp->level,
^
drivers/opp/core.c:1027:3: warning: Possible null pointer dereference: opp [nullPointer]
opp->bandwidth ? opp->bandwidth[0].peak : 0);
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1027:3: note: Null pointer dereference
opp->bandwidth ? opp->bandwidth[0].peak : 0);
^
>> drivers/opp/core.c:1590:20: warning: Possible null pointer dereference: opp2 [nullPointer]
if (opp1->rate != opp2->rate)
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1029:43: note: Calling function '_opp_compare_key', 2nd argument 'opp' value is 0
scaling_down = _opp_compare_key(old_opp, opp);
^
drivers/opp/core.c:1590:20: note: Null pointer dereference
if (opp1->rate != opp2->rate)
^
drivers/opp/core.c:1595:21: warning: Possible null pointer dereference: opp2 [nullPointer]
if (opp1->level != opp2->level)
^
drivers/opp/core.c:1089:27: note: Assignment 'opp=NULL', assigned value is 0
struct dev_pm_opp *opp = NULL;
^
drivers/opp/core.c:1130:33: note: Calling function '_set_opp', 3rd argument 'opp' value is 0
ret = _set_opp(dev, opp_table, opp, freq);
^
drivers/opp/core.c:1029:43: note: Calling function '_opp_compare_key', 2nd argument 'opp' value is 0
scaling_down = _opp_compare_key(old_opp, opp);
^
drivers/opp/core.c:1595:21: note: Null pointer dereference
if (opp1->level != opp2->level)
^
drivers/opp/core.c:1618:4: warning: Address of local auto-variable assigned to a function parameter. [autoVariables]
*head = &opp->node;
^
vim +1025 drivers/opp/core.c
f3364e17d5716a7 drivers/opp/core.c Viresh Kumar 2020-08-13 1000
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1001 static int _set_opp(struct device *dev, struct opp_table *opp_table,
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1002 struct dev_pm_opp *opp, unsigned long freq)
6a0712f6f199e73 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1003 {
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1004 struct dev_pm_opp *old_opp;
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1005 unsigned long old_freq;
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 1006 int scaling_down, ret;
6a0712f6f199e73 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1007
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1008 if (unlikely(!opp))
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1009 return _disable_opp_table(dev, opp_table);
aca48b61f963869 drivers/opp/core.c Rajendra Nayak 2020-04-08 1010
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1011 /* Find the currently set OPP if we don't know already */
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1012 if (unlikely(!opp_table->current_opp))
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1013 _find_current_opp(dev, opp_table);
6a0712f6f199e73 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1014
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1015 old_opp = opp_table->current_opp;
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1016 old_freq = old_opp->rate;
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1017
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1018 /* Return early if nothing to do */
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1019 if (opp_table->enabled && old_opp == opp) {
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1020 dev_dbg(dev, "%s: OPPs are same, nothing to do\n", __func__);
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1021 return 0;
6a0712f6f199e73 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1022 }
6a0712f6f199e73 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1023
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 1024 dev_dbg(dev, "%s: switching OPP: Freq %lu -> %lu Hz, Level %u -> %u, Bw %u -> %u\n",
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 @1025 __func__, old_freq, freq, old_opp->level, opp->level,
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 1026 old_opp->bandwidth ? old_opp->bandwidth[0].peak : 0,
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 1027 opp->bandwidth ? opp->bandwidth[0].peak : 0);
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 1028
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 1029 scaling_down = _opp_compare_key(old_opp, opp);
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 1030 if (scaling_down == -1)
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 1031 scaling_down = 0;
947355850fcb3bb drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1032
ca1b5d77b1c69df drivers/opp/core.c Viresh Kumar 2018-06-14 1033 /* Scaling up? Configure required OPPs before frequency */
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 1034 if (!scaling_down) {
2c59138c22f17c1 drivers/opp/core.c Stephan Gerhold 2020-07-30 1035 ret = _set_required_opps(dev, opp_table, opp, true);
ca1b5d77b1c69df drivers/opp/core.c Viresh Kumar 2018-06-14 1036 if (ret)
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1037 return ret;
ca1b5d77b1c69df drivers/opp/core.c Viresh Kumar 2018-06-14 1038 }
ca1b5d77b1c69df drivers/opp/core.c Viresh Kumar 2018-06-14 1039
7e535993fa4f671 drivers/opp/core.c Viresh Kumar 2018-06-12 1040 if (opp_table->set_opp) {
7e535993fa4f671 drivers/opp/core.c Viresh Kumar 2018-06-12 1041 ret = _set_opp_custom(opp_table, dev, old_freq, freq,
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1042 old_opp->supplies, opp->supplies);
7e535993fa4f671 drivers/opp/core.c Viresh Kumar 2018-06-12 1043 } else if (opp_table->regulators) {
c74b32fadc00f24 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1044 ret = _generic_set_opp_regulator(opp_table, dev, old_freq, freq,
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1045 old_opp->supplies,
c74b32fadc00f24 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1046 opp->supplies);
c74b32fadc00f24 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1047 } else {
947355850fcb3bb drivers/base/power/opp/core.c Viresh Kumar 2016-12-01 1048 /* Only frequency scaling */
1d3c42cabbd351e drivers/opp/core.c Viresh Kumar 2021-01-20 1049 ret = _generic_set_opp_clk_only(dev, opp_table->clk, freq);
c74b32fadc00f24 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1050 }
6a0712f6f199e73 drivers/base/power/opp/core.c Viresh Kumar 2016-02-09 1051
ca1b5d77b1c69df drivers/opp/core.c Viresh Kumar 2018-06-14 1052 /* Scaling down? Configure required OPPs after frequency */
f0b88fa45595254 drivers/opp/core.c Viresh Kumar 2021-01-21 1053 if (!ret && scaling_down) {
2c59138c22f17c1 drivers/opp/core.c Stephan Gerhold 2020-07-30 1054 ret = _set_required_opps(dev, opp_table, opp, false);
ca1b5d77b1c69df drivers/opp/core.c Viresh Kumar 2018-06-14 1055 if (ret)
ca1b5d77b1c69df drivers/opp/core.c Viresh Kumar 2018-06-14 1056 dev_err(dev, "Failed to set required opps: %d\n", ret);
c74b32fadc00f24 drivers/base/power/opp/core.c Viresh Kumar 2017-05-23 1057 }
052c6f19141dd13 drivers/base/power/opp/core.c Viresh Kumar 2017-01-23 1058
72f80ce4ef9b756 drivers/opp/core.c Viresh Kumar 2020-08-13 1059 if (!ret) {
b00e667a6d8b2b0 drivers/opp/core.c Viresh Kumar 2020-05-27 1060 ret = _set_opp_bw(opp_table, opp, dev, false);
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1061 if (!ret) {
72f80ce4ef9b756 drivers/opp/core.c Viresh Kumar 2020-08-13 1062 opp_table->enabled = true;
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1063 dev_pm_opp_put(old_opp);
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1064
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1065 /* Make sure current_opp doesn't get freed */
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1066 dev_pm_opp_get(opp);
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1067 opp_table->current_opp = opp;
81c4d8a3c41488e drivers/opp/core.c Viresh Kumar 2021-01-20 1068 }
72f80ce4ef9b756 drivers/opp/core.c Viresh Kumar 2020-08-13 1069 }
fe2af40250bfc3c drivers/opp/core.c Georgi Djakov 2020-05-12 1070
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1071 return ret;
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1072 }
386ba854d9f3163 drivers/opp/core.c Viresh Kumar 2021-01-21 1073
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-13 11:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-13 11:55 drivers/opp/core.c:1025:45: warning: Possible null pointer dereference: opp [nullPointer] kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2021-10-26 13:09 kernel test robot
2021-10-02 22:26 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.