soc: qcom: pdr: Avoid uninitialized use of found in pdr_indication_cb
authorNathan Chancellor <natechancellor@gmail.com>
Mon, 16 Mar 2020 20:48:55 +0000 (13:48 -0700)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Mon, 16 Mar 2020 21:56:57 +0000 (14:56 -0700)
commite69b3bede1b2f754a7d04383cbbc5a8b7327af79
treebb004e74bc032cb972ee0a1084f187844a6bbcda
parent83473566260288c560e5443ea4cc40a458aa9e6a
soc: qcom: pdr: Avoid uninitialized use of found in pdr_indication_cb

Clang warns:

../drivers/soc/qcom/pdr_interface.c:316:2: warning: variable 'found' is
used uninitialized whenever 'for' loop exits because its condition is
false [-Wsometimes-uninitialized]
        list_for_each_entry(pds, &pdr->lookups, node) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/linux/list.h:624:7: note: expanded from macro
'list_for_each_entry'
             &pos->member != (head);
             ^~~~~~~~~~~~~~~~~~~~~~
../drivers/soc/qcom/pdr_interface.c:325:7: note: uninitialized use
occurs here
        if (!found)
             ^~~~~
../drivers/soc/qcom/pdr_interface.c:316:2: note: remove the condition if
it is always true
        list_for_each_entry(pds, &pdr->lookups, node) {
        ^
../include/linux/list.h:624:7: note: expanded from macro
'list_for_each_entry'
             &pos->member != (head);
             ^
../drivers/soc/qcom/pdr_interface.c:309:12: note: initialize the
variable 'found' to silence this warning
        bool found;
                  ^
                   = 0
1 warning generated.

Initialize found to false to fix this warning.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Fixes: fbe639b44a82 ("soc: qcom: Introduce Protection Domain Restart helpers")
Link: https://github.com/ClangBuiltLinux/linux/issues/933
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Link: https://lore.kernel.org/r/20200316204855.15611-1-natechancellor@gmail.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/soc/qcom/pdr_interface.c