Received: by 2002:a05:6a10:5594:0:0:0:0 with SMTP id ee20csp179794pxb; Mon, 25 Apr 2022 08:03:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuVp8jJrKMcYpU6j+HVxvyiInLaQ8wfryydAe4f+d3qbxHTmbiXWD0RqNUCAKg4tlIflxW X-Received: by 2002:a17:907:2ce2:b0:6f3:6599:4ec with SMTP id hz2-20020a1709072ce200b006f3659904ecmr13796228ejc.318.1650899035718; Mon, 25 Apr 2022 08:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650899035; cv=none; d=google.com; s=arc-20160816; b=pIYjNDhhKD9JGTs75nSzvpg3IgoRZpx/Jphks+FNOfgkcVlht9fMAr4exW9Tsv8QZY A3+nXyQOQwtd9Z1FJeatkDOozVu7N8Gf3cOv4UzaGMqmBuWRWDdDtjKPNiaY7HHYKbkk sL3/k2xGyt/hDoW6lOKD6Yn5RBc+Op19LMtFLA4G9DU1SyyAE6ru44AHyR8fTsHpfOtR gWMUAZV3VCG/x7dL/z+Jk/ESRLe/e4N+/8vCAQ+3/4BAHV0lBv4JE0uLnheeN53ENrN7 2mzIY6uQLpAnbrn+rddVU+GfKykVWp7AvUfO3WnKz8x/S87VBbjQPB+qafQdetG5QZ34 cebw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=dDJ/LzqMqBO3XZu6dOm/MPZvoO3YhwRiG9dL+LZzogM=; b=da4Fh42N3A5DH+JBMJOsQ21Xsgv45GiwKjM6dUhoyak6sI9tlDYsn1BeF9WyiIJ2As 4eh8fqoDuX6mIfG45nI7faf2ldwVOIZ1STCPW/b2OteLH/Vx/llYoH8L1L7lO5vIjYXN ra7ItZUqsNuzudeRV58y/Gc1rtN6+74ESeYhraIaW3PABnBWnOTmUwnmyBlrsKsTsGxH 0NkLXix7YSwiuNoRYcKoSxqbjpQw11+2UPaIy4234f9kvBUzhfIALp1x5wqF/CKihbvb x0ADF3Sthliw3dCD8vaZfxUQR7u+nw+zYXp8xw3LqLLnsKXIjqXIeaG+07ne5wImexhi azuA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020a170906595900b006ee6fd74df2si3873797ejr.608.2022.04.25.08.03.12; Mon, 25 Apr 2022 08:03:55 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233806AbiDYIje (ORCPT + 99 others); Mon, 25 Apr 2022 04:39:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231161AbiDYIjb (ORCPT ); Mon, 25 Apr 2022 04:39:31 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE67B65D3B for ; Mon, 25 Apr 2022 01:36:23 -0700 (PDT) Received: from kwepemi500023.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KmyXQ1C0szhYkS; Mon, 25 Apr 2022 16:16:38 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500023.china.huawei.com (7.221.188.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 25 Apr 2022 16:16:48 +0800 From: Peng Wu To: , , CC: , , , , Peng Wu Subject: [PATCH -next] powerpc/iommu: Add missing of_node_put in iommu_init_early_dart Date: Mon, 25 Apr 2022 08:12:45 +0000 Message-ID: <20220425081245.21705-1-wupeng58@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500023.china.huawei.com (7.221.188.76) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak. Signed-off-by: Peng Wu --- arch/powerpc/sysdev/dart_iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c index be6b99b1b352..9a02aed886a0 100644 --- a/arch/powerpc/sysdev/dart_iommu.c +++ b/arch/powerpc/sysdev/dart_iommu.c @@ -404,9 +404,10 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) } /* Initialize the DART HW */ - if (dart_init(dn) != 0) + if (dart_init(dn) != 0) { + of_node_put(dn); return; - + } /* * U4 supports a DART bypass, we use it for 64-bit capable devices to * improve performance. However, that only works for devices connected @@ -419,6 +420,7 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) /* Setup pci_dma ops */ set_pci_dma_ops(&dma_iommu_ops); + of_node_put(dn); } #ifdef CONFIG_PM -- 2.17.1