]> git.baikalelectronics.ru Git - kernel.git/commit
regulator: max8660: fix assignment of pdata to data that becomes dead
authorColin Ian King <colin.king@canonical.com>
Tue, 7 Apr 2015 22:06:46 +0000 (23:06 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 8 Apr 2015 11:01:10 +0000 (12:01 +0100)
commita7fc4439a47f3f73845f1b4dc544ed2cdcb6033c
treeed0ddba2eb9b89632c9afa9f17464b626d8725a8
parent9cbe621030a9cce16d27329dac74fd4b1c1d9412
regulator: max8660: fix assignment of pdata to data that becomes dead

pdata is assigned to &pdata_of, however, pdata_of becomes dead (when it
goes out of scope) so pdata effectively becomes a dead pointer to the
out of scope object.  This is detected by static analysis:

[drivers/regulator/max8660.c:411]: (error) Dead pointer usage.
  Pointer 'pdata' is dead if it has been assigned '&pdata_of' at line 404.

Move declaration of pdata_of so it is always in scope.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/max8660.c