qcom_smem_state_get() leaks an OF node when args.args_count != 1 holds. Add a of_node_put() call before returning an error. This bug was found by an experimental static analysis tool that I am currently developing. Fixes: 9460ae2ff308 ("soc: qcom: Introduce common SMEM state machine code") Signed-off-by: Joe Hattori <joe@xxxxxxxxxxxxxxxxxxxxx> --- drivers/soc/qcom/smem_state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/qcom/smem_state.c b/drivers/soc/qcom/smem_state.c index d9bfac6c54fb..6a477e3c1316 100644 --- a/drivers/soc/qcom/smem_state.c +++ b/drivers/soc/qcom/smem_state.c @@ -112,6 +112,7 @@ struct qcom_smem_state *qcom_smem_state_get(struct device *dev, if (args.args_count != 1) { dev_err(dev, "invalid #qcom,smem-state-cells\n"); + of_node_put(args.np); return ERR_PTR(-EINVAL); } -- 2.34.1