From: Liang He Date: Thu, 21 Jul 2022 13:52:17 +0000 (+0800) Subject: soc: qcom: smem_state: Add refcounting for the 'state->of_node' X-Git-Tag: v6.1-rc5~304^2~7^2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90681f53b9381c23ff7762a3b13826d620c272de;p=platform%2Fkernel%2Flinux-starfive.git soc: qcom: smem_state: Add refcounting for the 'state->of_node' In qcom_smem_state_register() and qcom_smem_state_release(), we should better use of_node_get() and of_node_put() for the reference creation and destruction of 'device_node'. Fixes: 9460ae2ff308 ("soc: qcom: Introduce common SMEM state machine code") Signed-off-by: Liang He Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220721135217.1301039-2-windhl@126.com --- diff --git a/drivers/soc/qcom/smem_state.c b/drivers/soc/qcom/smem_state.c index 31faf4a..e848cc9 100644 --- a/drivers/soc/qcom/smem_state.c +++ b/drivers/soc/qcom/smem_state.c @@ -136,6 +136,7 @@ static void qcom_smem_state_release(struct kref *ref) struct qcom_smem_state *state = container_of(ref, struct qcom_smem_state, refcount); list_del(&state->list); + of_node_put(state->of_node); kfree(state); } @@ -205,7 +206,7 @@ struct qcom_smem_state *qcom_smem_state_register(struct device_node *of_node, kref_init(&state->refcount); - state->of_node = of_node; + state->of_node = of_node_get(of_node); state->ops = *ops; state->priv = priv;