summaryrefslogtreecommitdiff
path: root/drivers/soc/qcom
diff options
context:
space:
mode:
authorJakob Koschel <jakobkoschel@gmail.com>2022-03-24 08:24:35 +0100
committerBjorn Andersson <bjorn.andersson@linaro.org>2022-04-07 22:20:27 -0500
commit3be066542ec400e7cdbcef2a6ac1d36c5366a6f6 (patch)
treeeb24d43a518702336a14a3b7cab2d8a1704e74f8 /drivers/soc/qcom
parent3edff6262c48fe73feedc7277a3a6ebc3ed35a37 (diff)
downloadlwn-3be066542ec400e7cdbcef2a6ac1d36c5366a6f6.tar.gz
lwn-3be066542ec400e7cdbcef2a6ac1d36c5366a6f6.zip
soc: qcom: pdr: replace usage of found with dedicated list iterator variable
To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable instead of a found boolean [1]. This removes the need to use a found variable and simply checking if the variable was set, can determine if the break/goto was hit. Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Link: https://lore.kernel.org/r/20220324072435.63070-1-jakobkoschel@gmail.com
Diffstat (limited to 'drivers/soc/qcom')
-rw-r--r--drivers/soc/qcom/pdr_interface.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c
index fc580a3c4336..0034af927b48 100644
--- a/drivers/soc/qcom/pdr_interface.c
+++ b/drivers/soc/qcom/pdr_interface.c
@@ -304,24 +304,23 @@ static void pdr_indication_cb(struct qmi_handle *qmi,
notifier_hdl);
const struct servreg_state_updated_ind *ind_msg = data;
struct pdr_list_node *ind;
- struct pdr_service *pds;
- bool found = false;
+ struct pdr_service *pds = NULL, *iter;
if (!ind_msg || !ind_msg->service_path[0] ||
strlen(ind_msg->service_path) > SERVREG_NAME_LENGTH)
return;
mutex_lock(&pdr->list_lock);
- list_for_each_entry(pds, &pdr->lookups, node) {
- if (strcmp(pds->service_path, ind_msg->service_path))
+ list_for_each_entry(iter, &pdr->lookups, node) {
+ if (strcmp(iter->service_path, ind_msg->service_path))
continue;
- found = true;
+ pds = iter;
break;
}
mutex_unlock(&pdr->list_lock);
- if (!found)
+ if (!pds)
return;
pr_info("PDR: Indication received from %s, state: 0x%x, trans-id: %d\n",