From patchwork Sat Oct 22 07:23:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121048wrr; Sat, 22 Oct 2022 02:27:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4R4RHMM469YJCGC48i3ZQ7tG+jpEtolFwVwKhcuKn3UHlKngwQYhYwlEWXTGXMBg/qRfH0 X-Received: by 2002:a05:6a00:1c99:b0:562:6292:9e4e with SMTP id y25-20020a056a001c9900b0056262929e4emr23877878pfw.22.1666430839488; Sat, 22 Oct 2022 02:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430839; cv=none; d=google.com; s=arc-20160816; b=W5dA7S/6CRbL+W6auByEPvny6vp3zkCWOsC6uu9NHSFF+HSfcx9sQDKH2ooUYestDX We2edkJJpzbpY91J6S5MD+duEnDrRbyZTuEBSTCoxszJK2ZEGJzKGcJ8FQJ0VpcM4R2w ZILlV43/UxaPG53Yw+GrztIukNUNFw+08Q1bfAo4I42d6f6Sdfam0icPC9PkfTT3YcNe rOFIZPDPpIiZM1B5LCehx76vKzQ+15hejYc5I9bME/5kFbgUasRWgNdsEqpP6mNr7Idu 2rbyxW4Q1ufJE2aVx5heifPjAEkovE+nR6pmO3nsJnYAZSTqWXtYmtaNuy4yGu3LFexN UARw== 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=sSq3ClnfZwYfPAzE4jwxzvFOho+CfsQFE5w9Trln2NSjSAbhyrIMgubrw5AKN3FQAW PHLYiAoBWvsTYoXUUMl6J/9bS7wH+d2EneIskLoEdwTucIK2fXxlGg6Z8uZ+Agb/3tMa XA5fyVLHD5Da3sGH9EoK6UKH3aOWK2Q4+Fi/jwwMKoHN7gUGRLf0RqoIOZOKbyfEqsZk fpLohZLbevRF51YgxqN+y7RLtRPK0JwfCz6bflODbZrvq6LdMRLZPCjPizuY9rRtRpeC tpzFLrTfF2gFATX2yUdn9Hgmxv0+wd/hHWvcZi29JK3bgo8tehUNdztKxXH4ah8UFBpV +KHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GdX4p6vK; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 22-20020a630b16000000b0045a07a7c790si28309894pgl.740.2022.10.22.02.27.06; Sat, 22 Oct 2022 02:27:19 -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=GdX4p6vK; 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 S235129AbiJVJDw (ORCPT + 99 others); Sat, 22 Oct 2022 05:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235000AbiJVJDP (ORCPT ); Sat, 22 Oct 2022 05:03:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4EB12FA5DD; Sat, 22 Oct 2022 01:18:13 -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 dfw.source.kernel.org (Postfix) with ESMTPS id B4B3F60B24; Sat, 22 Oct 2022 07:49:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9A80C433C1; Sat, 22 Oct 2022 07:49:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424996; bh=OIyPrmQIsCOKB3WtDB3t9YMhRPWseYg73YUNm3OcaiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GdX4p6vKVwqTSNfWVaGN2W02qApZvz38XqjebpiyS/7TGny9b9FIj+2isHl5gupbh IKNw+fHX6KaDg/7f6ZNeu04Q9en/0VlF0rHpbAn6aY7Qw2NS38wD4knQG42fA/pVQr ECv+XyP2NRTlUk2BCCxuBDvOGNpvVUKaTCynuDlY= 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.19 353/717] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Sat, 22 Oct 2022 09:23:52 +0200 Message-Id: <20221022072511.527968726@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747379383775921056?= X-GMAIL-MSGID: =?utf-8?q?1747379383775921056?= 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;