Received: by 2002:a05:622a:251a:b0:39a:b4a2:e86 with SMTP id cm26csp3164502qtb; Mon, 24 Oct 2022 07:10:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7pFeRUbEpHwY8i+afujXlX/5tVgMT9sWWwaIa53DTIqxcRi69RX+XCZOMX8OUOIB2dPdiV X-Received: by 2002:a17:906:5a5f:b0:79f:9f1f:2fef with SMTP id my31-20020a1709065a5f00b0079f9f1f2fefmr12037087ejc.396.1666620539842; Mon, 24 Oct 2022 07:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666620539; cv=none; d=google.com; s=arc-20160816; b=0seyZT4hEL5OlN2MmduZOgivqDU9p8p6NXw3+2UOA0FdOKicvRWb8jO85g2aytAUTN SivD57QNextyJl77ZDCLrf43vT2q1DqD6RdFL4X4JnQZJAwpIUJZVGmUbuESPvo0LTQ1 PWYkuXEB9CSfaiH3Lzl+r9BBHc1US/+wjDgVqsMRxurt49A7Q8xGdaAdfyBk9vGDkJq4 zOeoUhZrp2xEDtOjl4ZWXRFU4csHmr8o+9fOBXii97FsdFEfvmhZHt8YEuSIOlv5b0m9 3XlhhsuXE655M+3Z1VPY/6jr2e98BA/qQjmw3PXmZpStci/DNSrb9Ch1GyCCUyYnwasg lCug== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv20-20020a17090760d400b007919388d2d1si20862025ejc.970.2022.10.24.07.08.34; Mon, 24 Oct 2022 07:08:59 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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; -- 2.35.1