From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B1ED2C32771 for ; Thu, 15 Sep 2022 23:29:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A6FBD610DE; Thu, 15 Sep 2022 23:29:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org A6FBD610DE X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bS5xazha2EI0; Thu, 15 Sep 2022 23:29:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 38677610E4; Thu, 15 Sep 2022 23:29:38 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 38677610E4 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F1FDEC0032; Thu, 15 Sep 2022 23:29:37 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id AA0F2C002D for ; Thu, 15 Sep 2022 23:29:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 7521D4047B for ; Thu, 15 Sep 2022 23:29:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 7521D4047B X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oKOs-hBNZJBe for ; Thu, 15 Sep 2022 23:29:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 8EC6D400FB Received: from outgoing2021.csail.mit.edu (outgoing2021.csail.mit.edu [128.30.2.78]) by smtp2.osuosl.org (Postfix) with ESMTPS id 8EC6D400FB for ; Thu, 15 Sep 2022 23:29:33 +0000 (UTC) Received: from [128.177.82.146] (helo=srivatsab-a02.vmware.com) by outgoing2021.csail.mit.edu with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.95) (envelope-from ) id 1oYyID-000q2X-RC; Thu, 15 Sep 2022 19:29:13 -0400 To: Liang He , jgross@suse.com, virtualization@lists.linux-foundation.org References: <20220915022343.4001331-1-windhl@126.com> From: "Srivatsa S. Bhat" Subject: Re: [PATCH] jailhouse: Hold reference returned from of_find_xxx API Message-ID: Date: Thu, 15 Sep 2022 16:29:06 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20220915022343.4001331-1-windhl@126.com> Content-Language: en-US Cc: jailhouse-dev@googlegroups.com, mark.rutland@arm.com, jan.kiszka@siemens.com, andy.shevchenko@gmail.com, robh+dt@kernel.org, wangkelin2023@163.com, "linux-pci@vger.kernel.org" , Bjorn Helgaas , Thomas Gleixner X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" [ Adding author and reviewers of commit 63338a38db95 ] On 9/14/22 7:23 PM, Liang He wrote: > In jailhouse_paravirt(), we should hold the reference returned from > of_find_compatible_node() which has increased the refcount and then > call of_node_put() with it when done. > > Fixes: 63338a38db95 ("jailhouse: Provide detection for non-x86 systems") > Signed-off-by: Liang He > Signed-off-by: Kelin Wang > --- > include/linux/hypervisor.h | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/include/linux/hypervisor.h b/include/linux/hypervisor.h > index 9efbc54e35e5..7fe1e8c6211c 100644 > --- a/include/linux/hypervisor.h > +++ b/include/linux/hypervisor.h > @@ -27,7 +27,11 @@ static inline void hypervisor_pin_vcpu(int cpu) > > static inline bool jailhouse_paravirt(void) > { > - return of_find_compatible_node(NULL, NULL, "jailhouse,cell"); > + struct device_node *np = of_find_compatible_node(NULL, NULL, "jailhouse,cell"); > + > + of_node_put(np); > + > + return np; > } > Thank you for the fix, but returning a pointer from a function with a bool return type looks odd. Can we also fix that up please? Regards, Srivatsa VMware Photon OS _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization