Commit e69b3bed authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Bjorn Andersson

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: default avatarNick Desaulniers <ndesaulniers@google.com>
Fixes: fbe639b4 ("soc: qcom: Introduce Protection Domain Restart helpers")
Link: https://github.com/ClangBuiltLinux/linux/issues/933Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Link: https://lore.kernel.org/r/20200316204855.15611-1-natechancellor@gmail.comSigned-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent 83473566
...@@ -306,7 +306,7 @@ static void pdr_indication_cb(struct qmi_handle *qmi, ...@@ -306,7 +306,7 @@ static void pdr_indication_cb(struct qmi_handle *qmi,
const struct servreg_state_updated_ind *ind_msg = data; const struct servreg_state_updated_ind *ind_msg = data;
struct pdr_list_node *ind; struct pdr_list_node *ind;
struct pdr_service *pds; struct pdr_service *pds;
bool found; bool found = false;
if (!ind_msg || !ind_msg->service_path[0] || if (!ind_msg || !ind_msg->service_path[0] ||
strlen(ind_msg->service_path) > SERVREG_NAME_LENGTH) strlen(ind_msg->service_path) > SERVREG_NAME_LENGTH)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment