From patchwork Mon Oct 24 11:30:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8826 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp431306wru; Mon, 24 Oct 2022 05:43:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5xoYRLS/kLAlT6RG9jOY3c9wl3YuEExwr1J9I8s/kXIhn/+0Ozf1MleKRqlR71kmLZBbex X-Received: by 2002:a63:950d:0:b0:46e:d655:b377 with SMTP id p13-20020a63950d000000b0046ed655b377mr11338467pgd.191.1666615407532; Mon, 24 Oct 2022 05:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615407; cv=none; d=google.com; s=arc-20160816; b=Ap9ucT9w66O3VNDo4AjIl/00sUtGKPv2ghPidZRiPpcr9q11FVTltHyfRRSqgTW48a AXqhVq+GwOX3dcDggTcdlKpBgYBLSDFJuqU88JTNj/G2yW6Zi5Fl8JV5/QQKBXB6uYgg ufBlERnRR0eSedR3GLxLiIH+HIYDVo6odMcGS+e+nPJcizIsH163rwJUYj1vK+w+sNPP HtSp0hxwuF07BiaLPNd+pkHmZOFcWt5x/F5wQx7t+aNYgPB42VeCw3Pbj1d6+Jz+EJns 9OSbJyDLs1bsLhaoWhTslgoZ84995u1IRajvjoMO7QX1rFCSolaA1hbj38mricCfaC3B xLFQ== 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=O44ViJKWLmVupMYvausLl0Nj8EZAFPZgc8VBRdZRPuQ=; b=Yv4sptQ/WZj2UH6J/AC9efJJC18I14ZMwcZYgfHgAfTVa4fSfDnqTI7ZbCjrOes27k Irj9evkYuAJ+ifxT9KlFk79uasbrU1dgFw+xXvwX8S6UMb0Ap54eU7EGy9BglLWdrQ1t rgJ8x1CwjBzVYOvfcLS6ZB/F/Yu8bVkVcAaz5P/Y6c2ctXZva8Th+bbT5+U0BX1/Tar+ v04oMWZGiMIPRlok3V2V7wPirVP8KtMEGy846QoK4rzosypMZZFOiDY0G3Rm1UL9xTQ2 ADpEFV+ZkH/8uDkOMPgFzSdAcMk9PCTg/giqYp7ejtH+eJ6BRQmW/UotzA52Z7BeIXwS xkqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wRo7FNJH; 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 e8-20020a170902ef4800b00176b7e66c9asi34800335plx.155.2022.10.24.05.43.04; Mon, 24 Oct 2022 05:43:27 -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=wRo7FNJH; 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 S231423AbiJXMgP (ORCPT + 99 others); Mon, 24 Oct 2022 08:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234330AbiJXMaE (ORCPT ); Mon, 24 Oct 2022 08:30:04 -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 9805631DFF; Mon, 24 Oct 2022 05:04:04 -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 91DE6B811AB; Mon, 24 Oct 2022 11:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5BDFC433D6; Mon, 24 Oct 2022 11:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612284; bh=E6nMjH9elQkFPPehNJVGitkxW67b30EoBEbRIBxoJYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wRo7FNJHlHiS0+GcLZuJsRLilyHnWHFC7+WwJqWnc7q1EQSVWQjVQMbicJC1keG78 unq8WAaFAJfkE8YeNy8pN5tM5zqoUM50DRLZpSALmBb+uczfgyvzI9aBdwatQfiMCv RxecflTe7Bh8MlALzCeE0/kfMlJ9Rg7wRVGX9JlM= 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 4.14 108/210] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:30:25 +0200 Message-Id: <20221024113000.516514952@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112956.797777597@linuxfoundation.org> References: <20221024112956.797777597@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?1747572917331341622?= X-GMAIL-MSGID: =?utf-8?q?1747572917331341622?= 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 d5437ca76ed9..1502cf037a6b 100644 --- a/drivers/soc/qcom/smem_state.c +++ b/drivers/soc/qcom/smem_state.c @@ -144,6 +144,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); } @@ -177,7 +178,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;