Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7390913rwi; Mon, 24 Oct 2022 14:02:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM65FlaTpnapFmJ9Y6mCKOml8Zr71oGDHNbFp2iOOjwowcELAWETyKTMnBHTEha0GZomYrIy X-Received: by 2002:a05:6402:518d:b0:45d:d319:2a88 with SMTP id q13-20020a056402518d00b0045dd3192a88mr31596409edd.35.1666645357345; Mon, 24 Oct 2022 14:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666645357; cv=none; d=google.com; s=arc-20160816; b=RFVV9Mlt+cyaIDaB/zSHfttYsbHkUkV6IZlMxbK2BIhD0ZbRfsCZq+sB+0hstgAdnE P4hVyW7OUmX1DdXUEBsPiUjlzeZ38ShQtPc3+6IplX1bJURto2eH6wFJgyzaSnVtBggA 0tlr7tDuTzwOFvwmseCeXWPV+R3USont6an2FjGWDj67CXT8u8xvxH9v7azqexycp6JH hCIzlll0Xg1Uxrj+O6km0Y+x9oOmU2hEPzDzW56TMkU3HN4gdTSPeSowbmCeG9Xnursh GxW37+XGK5iBfBHEWJ9L6w2sRUg4ffe9d+mPeGfkfNYQ4VV2S9wAHt3K0faTaTIyfHqo fJAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4OtXHtQup1rGtIK/IDVIEl+JFc9Pp/hplrE967immRY=; b=GXaT4OwMubHdNzk16rgPBQyir4ixkegUWBtSosF9GJmuHfGqJRaOpE0bEvAauDSJ7A 9Kli9K9hyWL1BfF46+SoovkYRG9GCAf3GO92YP3jgxm5yO01y9vIY6XQXNur0qPSK9mh b7dlwFEA0zYyHG2f1af9XydUA/7kzjgQnBMW0ECojEBbi9agKB6uX8TWcqH9y+7nE4kK ZnE0IT1krfbkByCxAUri3hX71yHeajJckmkyOlu0TlN1WhdYXJZYp6m2OJ928ivBmJV9 ug5slYLWfkuspwnyQwn4/qhBwgdfKzG0zGNqfILiWGLpk92eaMRBYa3tmXlMoAkYcI8E iYyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fqm8KOBt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g15-20020a170906520f00b00782393c36cfsi727306ejm.336.2022.10.24.14.02.10; Mon, 24 Oct 2022 14:02:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fqm8KOBt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230329AbiJXUcv (ORCPT + 99 others); Mon, 24 Oct 2022 16:32:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234244AbiJXUbx (ORCPT ); Mon, 24 Oct 2022 16:31:53 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF5E4237C9; Mon, 24 Oct 2022 11:43:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 36385CE13C5; Mon, 24 Oct 2022 12:23:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21C67C433C1; Mon, 24 Oct 2022 12:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614213; bh=kQWJbAtvZifP1shAjObse3DkaoIE1hj0tuT6mBsGAMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fqm8KOBtx2LXS4+xuT+gXkSFLPPanEkLw1HZjEVhjMa+452fmxSJtmcwXImpqHbkY 7jRY0lD/3A1vR3vocCpdsX7ThVYvbWABivFbQxY3YVRpJQb4Wmyfuc+AexqlBr3y8w GDccWbn8J+JV2xkwjjYx64sksiOLiZjlN66Kp+ZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.10 175/390] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:29:32 +0200 Message-Id: <20221024113030.171421867@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liang He [ Upstream commit 90681f53b9381c23ff7762a3b13826d620c272de ] 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 Signed-off-by: Sasha Levin --- drivers/soc/qcom/smem_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/smem_state.c b/drivers/soc/qcom/smem_state.c index d2b558438deb..41e929407196 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); } @@ -169,7 +170,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; -- 2.35.1