From patchwork Mon Oct 24 11:29:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp642197wru; Mon, 24 Oct 2022 13:37:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Qh1tnlSiOd8ExbZgpL9mLa4+n6BGuLxYx9+pz9Q51dtlgJ4JjzdSi7d02BAmKncQ7LC5M X-Received: by 2002:a63:e04:0:b0:46b:2bef:338c with SMTP id d4-20020a630e04000000b0046b2bef338cmr29311314pgl.206.1666643863429; Mon, 24 Oct 2022 13:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643863; cv=none; d=google.com; s=arc-20160816; b=Ubw7uaubog+t+KrkunBknFarAOpp76SK7zBvpwrjygEMyZHR1IjRbqJ1QAwD56Fm7X hafOrF4VD5Dy+9uS/ZYhZCR/2TD8gumc7zKuTewZDQZe6V7j3bHhxaX0znxW59ttz5nZ KmGw9roN2BssdyoYpoK/uM6kOhP8Z3qpdvhs6Hjq5AhfYS9GKH1mnVsfPskuN3F89zB3 2oj4Ne07h6/f+Ho+vCFT5MtcU8PiurGPvnuj+VxDF2rRYPj6j4YuseX07NOKXpLD0jP5 N2QRrlVjLTrw6KzXnrDYd8IMVsbDurINBHpOW8urTOCEZG9LV8JagkvMPKhSv0TN5ic2 u/vg== 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=GXaT4OwMubHdNzk16rgPBQyir4ixkegUWBtSosF9GJmuHfGqJRaOpE0bEvAauDSJ7A 9Kli9K9hyWL1BfF46+SoovkYRG9GCAf3GO92YP3jgxm5yO01y9vIY6XQXNur0qPSK9mh b7dlwFEA0zYyHG2f1af9XydUA/7kzjgQnBMW0ECojEBbi9agKB6uX8TWcqH9y+7nE4kK ZnE0IT1krfbkByCxAUri3hX71yHeajJckmkyOlu0TlN1WhdYXJZYp6m2OJ928ivBmJV9 ug5slYLWfkuspwnyQwn4/qhBwgdfKzG0zGNqfILiWGLpk92eaMRBYa3tmXlMoAkYcI8E iYyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Fqm8KOBt; 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 w18-20020a170902e89200b001769e71398csi623345plg.340.2022.10.24.13.37.29; Mon, 24 Oct 2022 13:37:43 -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=Fqm8KOBt; 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 S230329AbiJXUcv (ORCPT + 99 others); Mon, 24 Oct 2022 16:32:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234244AbiJXUbx (ORCPT ); Mon, 24 Oct 2022 16:31:53 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF5E4237C9; Mon, 24 Oct 2022 11:43:41 -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 sin.source.kernel.org (Postfix) with ESMTPS id 36385CE13C5; Mon, 24 Oct 2022 12:23:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21C67C433C1; Mon, 24 Oct 2022 12:23:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614213; bh=kQWJbAtvZifP1shAjObse3DkaoIE1hj0tuT6mBsGAMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fqm8KOBtx2LXS4+xuT+gXkSFLPPanEkLw1HZjEVhjMa+452fmxSJtmcwXImpqHbkY 7jRY0lD/3A1vR3vocCpdsX7ThVYvbWABivFbQxY3YVRpJQb4Wmyfuc+AexqlBr3y8w GDccWbn8J+JV2xkwjjYx64sksiOLiZjlN66Kp+ZI= 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.10 175/390] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:29:32 +0200 Message-Id: <20221024113030.171421867@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747602755657125077?= X-GMAIL-MSGID: =?utf-8?q?1747602755657125077?= 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;