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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 AC2ACCCA483 for ; Fri, 1 Jul 2022 14:51:45 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LZJ7M6yQLz3dtF for ; Sat, 2 Jul 2022 00:51:43 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=ZnNLhFMA; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=126.com (client-ip=220.181.15.112; helo=m15112.mail.126.com; envelope-from=windhl@126.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=ZnNLhFMA; dkim-atps=neutral Received: from m15112.mail.126.com (m15112.mail.126.com [220.181.15.112]) by lists.ozlabs.org (Postfix) with ESMTP id 4LZJ5y6hXLz3cJC for ; Sat, 2 Jul 2022 00:50:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=Cs1hk euBoQjKrX/Ip43i0w3A2PsBGXG4v1L3BMOCxMc=; b=ZnNLhFMAyCsQPUywX6RBE 8d4bcomIGiQTDgYs75Np4TKIQukzdTOkxbMx/AWLEz44F/bFxin0jqyKtg+MiHI6 mUsK6ry0jo77iDqgrNJTJjmxA/U6qE/BEKGs9BzL/cs45MU35AT6BGBUI41OWWcr gxlR1RVlMtln5pgcg9h3uk= Received: from localhost.localdomain (unknown [124.16.139.61]) by smtp2 (Coremail) with SMTP id DMmowABHs_+NCb9ix2bbEA--.53667S3; Fri, 01 Jul 2022 22:49:51 +0800 (CST) From: Liang He To: arnd@arndb.de, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, linuxppc-dev@lists.ozlabs.org, windhl@126.com Subject: [PATCH v2 2/2] powerpc: cell: iommu: Hold reference returned by of_find_node_by_name() Date: Fri, 1 Jul 2022 22:49:49 +0800 Message-Id: <20220701144949.252364-2-windhl@126.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220701144949.252364-1-windhl@126.com> References: <20220701144949.252364-1-windhl@126.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: DMmowABHs_+NCb9ix2bbEA--.53667S3 X-Coremail-Antispam: 1Uf129KBjvJXoW7Xw1rZrykAF4ruF4kJr47Arb_yoW8JrW3pr nrGrZFkF18GrWrKF17tF17Zry2van3try0vFWUC3yDArn5Xr9rZFW8Zw1fWFn8XrWDAa1S qF4SqanY9FnYga7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRY9a9UUUUU= X-Originating-IP: [124.16.139.61] X-CM-SenderInfo: hzlqvxbo6rjloofrz/1tbizhAxF18RPaeCDQAAsj X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" In cell_iommu_init_disabled(), we should hold the reference returned by of_find_node_by_name() and use it to call of_node_put() for reference balance. Signed-off-by: Liang He --- changelog: v2: (1) split v1's two files in to two commits (2) using 'check-then-put' coding style v1: hold the reference returned by of_find_xxx OF APIs v1-link: https://lore.kernel.org/all/20220621075333.4081413-1-windhl@126.com/ arch/powerpc/platforms/cell/iommu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 0ca3efeef293..8c7133039566 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -720,8 +720,10 @@ static int __init cell_iommu_init_disabled(void) cell_disable_iommus(); /* If we have no Axon, we set up the spider DMA magic offset */ - if (of_find_node_by_name(NULL, "axon") == NULL) + np = of_find_node_by_name(NULL, "axon"); + if (!np) cell_dma_nommu_offset = SPIDER_DMA_OFFSET; + of_node_put(np); /* Now we need to check to see where the memory is mapped * in PCI space. We assume that all busses use the same dma -- 2.25.1