From patchwork Mon Oct 24 11:30:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8925 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp434665wru; Mon, 24 Oct 2022 05:52:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6KeZMHzmuEzDIAd2j1+u3Jxp6CJfHRu/Td8Lrma//LqEN6cypA9zmP6Zu+QHKIyknFjemz X-Received: by 2002:a17:907:94d6:b0:78d:f947:7cf5 with SMTP id dn22-20020a17090794d600b0078df9477cf5mr27141933ejc.446.1666615950218; Mon, 24 Oct 2022 05:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615950; cv=none; d=google.com; s=arc-20160816; b=LU5gpN51iOkHrEjosVD6kkL71qtQQrQ9miGDSgDybXwvuqJ07c+fDLPIQee6HnkWL/ pl0JEoDoD0tY1LZcx3qc6QvbMU9D3lizNQ3eT6bWmVawE62U+8OSG4JJOSdBfgYWKO9K 9+bGGnGn3nrNsOtyKUBsfnp7LDDGB3pMA0+yb/g0VJvfrDO/y1MYbm6Esft8x0n63S8z DQvaZzRcpKJNcIOQdVOT0wfV6ujNRl5LJOdhwSFRQi7qd12XZhMkaJEyEYyRR2DhsQQ/ KVH3YgnOVf65sH7nKcVQ55//OSFiLlXbr1QGAZv7u+E7JlLiXmIMvwq2hYw28pdpqKCO K/PQ== 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=WDpIpC2va2mTP2J70i2CfpjPZ5n4/MDxcVQmvVQaWuPYvCpbKL3RU4IM1cpgEwk/xW rsfSRGdU01BTPEDrjANwV55H4DLqoweR9+ibZAaoGBGnChENIiC8ubeNWsZRiSCBgSv1 AAjsLsaxdSpWOeMNIC5BxbuIafXYuLG10bXxqmTa3SxNWmGpc4z7yn1aPSPSB3IT5uq2 7ZGzQ9VALC0//QU0DMfborzgn0eiJQBrgUyfyRAKoY/XCoHmCEXQDYvQzXjxJw1fA3+z eqXBnyb8F1YakMmiOyc4DbLDb43WA8RTQ1xFAcs2v9Jw5CcYAxM9uAWN5guLhsNmDsSp C2HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=reDOfpne; 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 qf8-20020a1709077f0800b0078d62ae01c1si29782498ejc.536.2022.10.24.05.52.05; Mon, 24 Oct 2022 05:52:30 -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=reDOfpne; 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 S234415AbiJXMvA (ORCPT + 99 others); Mon, 24 Oct 2022 08:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234660AbiJXMp1 (ORCPT ); Mon, 24 Oct 2022 08:45:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0113A193DF; Mon, 24 Oct 2022 05:09:58 -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 855E76125D; Mon, 24 Oct 2022 12:09:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B653C433C1; Mon, 24 Oct 2022 12:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613372; bh=kQWJbAtvZifP1shAjObse3DkaoIE1hj0tuT6mBsGAMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=reDOfpneOrbcXU9Jlex5H13XUl9Sp/sjF3877AoXTUh5gNo7Rcq/gNhxdIzBeHgdh eVg/Y3iTjsDp/vlgSBqCaK7gV5ugHcY35aIeMH6kI+cHzhmFRZF+8hMhxAkW7eOM1M 1QSuvAoE/2PP/watZM6sUo38vVqybmrMFZBdjE4Y= 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.4 111/255] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:30:21 +0200 Message-Id: <20221024113006.185176924@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747573486427873580?= X-GMAIL-MSGID: =?utf-8?q?1747573486427873580?= 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;