From patchwork Wed Oct 19 08:28:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5254 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp273885wrs; Wed, 19 Oct 2022 04:43:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JCqjVSjBy4XyUpVQ/0Ipg0BtP8BeHLQ+dImt3ZcnBv/wt29jYvdyjF7AqKYQiMRE1xeMe X-Received: by 2002:a65:6042:0:b0:440:56aa:d5cf with SMTP id a2-20020a656042000000b0044056aad5cfmr6836421pgp.81.1666179795968; Wed, 19 Oct 2022 04:43:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666179795; cv=none; d=google.com; s=arc-20160816; b=Utke0X16qirxDctp9RM5sdF+DIwSSLBJCEaPGxJB5sNcOgMDPorYOjuCOHGcZiJx15 SBZTbZK9YR+HMgKK8mYd1zORFNGeXrpuB6m0pL6+7f0d5foOflZsX0c4wray2eMkIz5j olHnapOSCBWFy6WWX5uo4BEvRx0HcBRg+ky7jVQ1z+ETgwH54fXqqrgofbNFWhrRxKYK 8evemdtvI2Uwe5hOSCshJ2vB1OhMLe7H2YgHarZ3DJYQyHbZqekhJtm6S8nwB20yW6NT impWeQl1daUdnrYi1TzcBR3qVDaAbYYjph2AWNW+OCukCa5F8mj33pV5h+RHGjmjzgTa hXFw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nl5-20020a17090b384500b00205dfd2c794si25431209pjb.167.2022.10.19.04.43.01; Wed, 19 Oct 2022 04:43:15 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747116145542472448?= X-GMAIL-MSGID: =?utf-8?q?1747116145542472448?= 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;