Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp963902rwi; Wed, 19 Oct 2022 05:15:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gJnewq9C1jioExrW61YiDOBiMbjP2Hmb5pJVgGJAWVXFWt309gaRwvvgG2c+BuG15lm8G X-Received: by 2002:a05:6402:51c9:b0:45d:5efe:d1a3 with SMTP id r9-20020a05640251c900b0045d5efed1a3mr7141053edd.58.1666181716401; Wed, 19 Oct 2022 05:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666181716; cv=none; d=google.com; s=arc-20160816; b=HATAxyblo0dV9ysfmRU5EryFY8Ytid2dRL5vFv5oqnnC7cAZ6hGmA2FXQzJAEouG0c qRi7V8hB9si/wmLQOZTE7K/0T8AuqbeWToYDouIMm6qrjPhcg6Mq4UH0v6WREtCOJHjM L28XIGnD0m6CN+8WX3N6oqwZJWFVOTjMTv4Fzl+YwPW1hQdLoI6AD+ppGKJib59b2f/q iro3/2I6NX9psORjL9IfuhRBfv0LoaNmYbKq3WcA4Iof1chYzsrzK4XigVaEd0HSKYvc tJJn8kjSmv728Gr3CJrC/ZAflDikAbuN5zYVkmylBwmLJpaOBLkOfYB3rQlvZrymBKRq GrtQ== 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=k3PzK0abBm+JtQPkVhDNc9iNsk/dPFRF72EgCCjLfK0=; b=IQFuyPf3lFN5jpdHdZfSSyLBKMcm0CJemmnEYRX0iuLspaiYZppxbZSka+Xbbx6KyR f2pUIHt9jwkJtrO4Q657JUZ+iKoFKyTe4G8YJZtI2nYqIzdp9ih42pdzZZQ8Ww4iXhGt 2SZiSRc7LikOfz2z9xycdWjX7ZfedTsTp9K0APmWEkaejdNw+1dhm5UOZsTpwuhi6MPc dsLZ6817gJbzwjhZteyEftj2sIblOCAbGsHRCx/ONefl0kwFMImcZWN+gvOvpjw1XyTi 9b/qIRptudb9RtXZTLraadvZPoz8Q66wGCurE18z7XXlztVrPoKqSpwemOcYW+3QE6ss MdUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="1/bnvQQ1"; 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 x7-20020a170906148700b0078200f94d06si12328489ejc.237.2022.10.19.05.14.35; Wed, 19 Oct 2022 05:15:16 -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="1/bnvQQ1"; 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 S231531AbiJSLgR (ORCPT + 99 others); Wed, 19 Oct 2022 07:36:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231510AbiJSLfx (ORCPT ); Wed, 19 Oct 2022 07:35:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F439DF9C; Wed, 19 Oct 2022 04:13:00 -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 ams.source.kernel.org (Postfix) with ESMTPS id 54974B82429; Wed, 19 Oct 2022 08:56:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0035C433C1; Wed, 19 Oct 2022 08:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169816; bh=OIyPrmQIsCOKB3WtDB3t9YMhRPWseYg73YUNm3OcaiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1/bnvQQ1JTeuq02twOXIb6iiWRJFKeB2bYfLpoLzxxsi0u2DGyCY1H1yN+JJGdu1x KTjk7dVBftJHpIf8c2J/v/vmds6PDQBMgFkUkdpKB/SvXw4PsFfoVo7KA+NKmUc47l ignQnY4iaixRzhfZt6YUHe8qRBDEOZlIjMWLrIKw= 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 6.0 420/862] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Wed, 19 Oct 2022 10:28:27 +0200 Message-Id: <20221019083308.525235431@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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.4 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 31faf4aa868e..e848cc9a3cf8 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; -- 2.35.1