Re: [kbuild] [regulator:topic/da9211 1/1] drivers/regulator/da9211-regulator.c:268 da9211_regulator_init() warn: variable dereferenced before check 'chip-pdata' (see line 260)
On Tue, Jul 15, 2014 at 08:53:52AM +, Opensource [James Seong-Won Ban] wrote: Hi Dan, There is no problem in the code because the pdata is checked before the function. Do I have to do something? The checker is saying that the code doesn't make sense as-is becuase we dereference chip-pdata and we have a check to see if it is NULL. The check doesn't make sense because we would have crashed already at that point. You are saying that the extra check for chip-pdata is not needed. if (chip-pdata) config.init_data = (chip-pdata-init_data[i]); Just delete it then. That way the code will make sense and be consistent. regards, dan carpenter ___ kbuild mailing list kbuild@lists.01.org https://lists.01.org/mailman/listinfo/kbuild
[kbuild] [regulator:topic/da9211 1/1] drivers/regulator/da9211-regulator.c:268 da9211_regulator_init() warn: variable dereferenced before check 'chip-pdata' (see line 260)
TO: James Ban james.ban.opensou...@diasemi.com CC: Mark Brown broo...@linaro.org tree: git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git topic/da9211 head: 1028a37daa148cc6cf85aa2aecb4390ddf1e1e56 commit: 1028a37daa148cc6cf85aa2aecb4390ddf1e1e56 [1/1] regulator: da9211: new regulator driver :: branch date: 38 minutes ago :: commit date: 38 minutes ago drivers/regulator/da9211-regulator.c:268 da9211_regulator_init() warn: variable dereferenced before check 'chip-pdata' (see line 260) git remote add regulator git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git git remote update regulator git checkout 1028a37daa148cc6cf85aa2aecb4390ddf1e1e56 vim +268 drivers/regulator/da9211-regulator.c 1028a37d James Ban 2014-07-14 254 */ 1028a37d James Ban 2014-07-14 255 if ((chip-pdata-num_buck == 2 data == 0x40) 1028a37d James Ban 2014-07-14 256 || (chip-pdata-num_buck == 1 data == 0x00)) { 1028a37d James Ban 2014-07-14 257 if (data == 0) 1028a37d James Ban 2014-07-14 258 chip-num_regulator = 1; 1028a37d James Ban 2014-07-14 259 else 1028a37d James Ban 2014-07-14 @260 chip-num_regulator = 2; 1028a37d James Ban 2014-07-14 261 } else { 1028a37d James Ban 2014-07-14 262 ret = -EINVAL; 1028a37d James Ban 2014-07-14 263 dev_err(chip-dev, Configuration is mismatched\n); 1028a37d James Ban 2014-07-14 264 goto err; 1028a37d James Ban 2014-07-14 265 } 1028a37d James Ban 2014-07-14 266 1028a37d James Ban 2014-07-14 267 for (i = 0; i chip-num_regulator; i++) { 1028a37d James Ban 2014-07-14 @268 if (chip-pdata) 1028a37d James Ban 2014-07-14 269 config.init_data = 1028a37d James Ban 2014-07-14 270 (chip-pdata-init_data[i]); 1028a37d James Ban 2014-07-14 271 --- 0-DAY kernel build testing backend Open Source Technology Center http://lists.01.org/mailman/listinfo/kbuild Intel Corporation ___ kbuild mailing list kbuild@lists.01.org https://lists.01.org/mailman/listinfo/kbuild