From patchwork Mon Oct 24 11:30:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8497 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp404028wru; Mon, 24 Oct 2022 04:54:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ELOoRcq8R9KBC1Qq0WjbjIagM11dkDYo4g1NFlTdtQNRnzKQVef+23OHUJVoe14UllSBU X-Received: by 2002:a05:6a00:1a88:b0:566:8d0e:30eb with SMTP id e8-20020a056a001a8800b005668d0e30ebmr33500353pfv.13.1666612443661; Mon, 24 Oct 2022 04:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666612443; cv=none; d=google.com; s=arc-20160816; b=i2h0RXJKipUK0P/evREtO8Dv6JOTOENV/8HR+BOj+czXyKusHFtZiATl4I4gomlyt+ /9DWXoSAWUXuVzJ/0Zyys2IqdM3QiCVNeiQUX5+6mlkrYJj3EEyF2jQ1pOvfBLEufuCY QyEvpQUqDzOvmGUYIkm5NrKMo6jWWlW38+a2mqpMKXHcQ3ZTbmBCVT9B5kJUIViXOyxl UyuaC4ON4egpUW+5Pvj37y91dJzwHx3n3pMc1wpLWI+PGmJaeyexamNwVSfNl9YQ5bp2 MpkXS7nmkIDkjlZcXxVDXQmEzZpfTK6yNN/WaexbHUrHNMwZbdEdlWBB6XeJbFhDdoxR AcrA== 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=nPM9iqWNU5vRQs9Tdo0GqFULEuMu1Du/hJPTdMIwpLdgDWt05I1t062lGZydc4zRc8 DsoIGE5dujOz7emrfasDcYVi7UwJEhUEFp+8A82K+dmK0wcw3Add1DOsHw87DVQvTVS4 nKsHvMnON4CIHm+1mylUh3Eb9XOU3nts6P6pL6TCXzXV1LLl2RAAQXWLwwViuUgxHaaU XAnOFInw47qm4LDUWZf5TaH9ldxu6WvXrZS4YyUTCT4pLZqm4QkGY9A1VUzoegP9wC04 zBoT/cFonQ995zrepbNUY6evRG+7txQDM1szc44U/orJka8HTioXWOfoXcraCPhgbYZ0 wn6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gzGvHiid; 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 3-20020a17090a08c300b0020267707b1csi8072791pjn.59.2022.10.24.04.53.50; Mon, 24 Oct 2022 04:54:03 -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=gzGvHiid; 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 S232117AbiJXLxj (ORCPT + 99 others); Mon, 24 Oct 2022 07:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231696AbiJXLww (ORCPT ); Mon, 24 Oct 2022 07:52:52 -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 6B4303CBFD; Mon, 24 Oct 2022 04:45:00 -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 3BDEAB8115E; Mon, 24 Oct 2022 11:43:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DA1BC433D6; Mon, 24 Oct 2022 11:43:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611796; bh=E6nMjH9elQkFPPehNJVGitkxW67b30EoBEbRIBxoJYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gzGvHiidru9PRom2K0KsAKI7S8HmQ+i8tKvLoHiaZZm4wbPvVkis0eNoH/jVxu42b AfyHYpavQRfHcT6knY6eWo6HGOW4jdYXw3aKsg7uuu/p8kzsyNaawHH1zuq9wEUOuo HVZNrjGqlvkHNeV88Nfe+dt+nVfnuzd+T7GZ6Yys= 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.9 084/159] soc: qcom: smem_state: Add refcounting for the state->of_node Date: Mon, 24 Oct 2022 13:30:38 +0200 Message-Id: <20221024112952.486749575@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112949.358278806@linuxfoundation.org> References: <20221024112949.358278806@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?1747569809980866138?= X-GMAIL-MSGID: =?utf-8?q?1747569809980866138?= 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;