From patchwork Mon Oct 24 11:30:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8731 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp423812wru; Mon, 24 Oct 2022 05:25:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68AN1TXduV73ra/+IKRSZuDPH5S0Fa2Bb6QayKP/cvaipSV4Dkyy/LvpAAd1natE8A6lAa X-Received: by 2002:a17:902:9a8b:b0:17a:455:d967 with SMTP id w11-20020a1709029a8b00b0017a0455d967mr33035660plp.52.1666614351569; Mon, 24 Oct 2022 05:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666614351; cv=none; d=google.com; s=arc-20160816; b=vcsF5OoZQ0TiJPkFEQsqu7QFfMfCUmVMEC0qWEOYJOhS1jJHxtYFbIiov8MYvGpMg7 A4eackCnTTYnrwOAxBgOv5jv7f0CZuHNXPjZhbYNlR+voTXLmbMwiTrhJZo/RpIf4cZq 3vgIym+713T1AaWk4uCjtMNo8F+PrGepGCiyPPDNSEK5AXWjUKaP/IKvCBh5WQekNvlD LnExlNd6Nx+kHS98f+uUMLOd9ON4CKPRY/kjW3+jKAivCTRo0snGWTcjkyRnRNzW7VWK k/FAnbzzE6u9tRlJF1p8pzakkcR6yJLUwpb5ZybEH/R+w44ooHFm05Hm+XaIU3BXJ2qr H20Q== 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=oJ7bmOUHMtMa8PAMELf26Z75DQTdsweAmhytUuZDmD/QOrGXoyU6pkZ4XCsJIhBmIu FduJxM0hT3Zx368VAaJt6eQjJIVyU8AK01g6X1ThbhE1YtDhouaq/lF1awwMgBaIAF+z GwC/leTLlIJHltYNfS2rBiVOUHreFtgNc1eQBqJ8RyYwxxfjBEGMDk3AhxNK8s+rZalo j1HW52FLAK/ceXeXHYeoOOwu5epXBOV+2UrrnEoj+1eflwE1NEhPjBjJzWqRSGQggdcx xKcbXg2WdxKK8VatcWmAeAaX5UjpN5/qCOVBuR3LHqbIdg8y4YQT2TzXM1PMIJ1z8JWg pzYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UgulYvEc; 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 l10-20020a170902f68a00b001869c035f20si6471246plg.381.2022.10.24.05.25.38; Mon, 24 Oct 2022 05:25:51 -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=UgulYvEc; 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 S233583AbiJXMZJ (ORCPT + 99 others); Mon, 24 Oct 2022 08:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233238AbiJXMXf (ORCPT ); Mon, 24 Oct 2022 08:23:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE4E413CCC; Mon, 24 Oct 2022 04:59:42 -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 EE5EB6129E; Mon, 24 Oct 2022 11:59:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09C8EC433D6; Mon, 24 Oct 2022 11:59:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612764; bh=E6nMjH9elQkFPPehNJVGitkxW67b30EoBEbRIBxoJYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UgulYvEc533CIu836IRc5LjGl4+pjTti3XUF44cfnGQTHOGC+kzGB3NqwN1lM1adn mdCAagw4ONQ/xNy6K/Uit/JdxLknDttgO+JAUhisbZWNThsI95fHaN5bOxQjU9tlxL tWKgbhIdctBU3qqP0AcCDR7Oe5RlfIoj3jyY8XP4= 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.19 110/229] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:30:29 +0200 Message-Id: <20221024113002.566943406@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@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?1747571810095452349?= X-GMAIL-MSGID: =?utf-8?q?1747571810095452349?= 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;