Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3718782ioa; Tue, 26 Apr 2022 08:53:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/jmjLhYFxYiJFcxhvsqfP3yrmz6KwYvE3q4VTLs29uWSq1TIc+Qh4Ts6751AZA28KI9oU X-Received: by 2002:a17:90a:c797:b0:1d9:2764:a83b with SMTP id gn23-20020a17090ac79700b001d92764a83bmr20922862pjb.5.1650988428937; Tue, 26 Apr 2022 08:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650988428; cv=none; d=google.com; s=arc-20160816; b=acfJHTheO7tfhyzW8whz3TaZCkEX66Y7GzHdkBuyqJTp9TLR2L8LxSJLVo3zcTnuTU jNVndW4CVyAWnBazUOnB1wchkgsWv0sheHpS/2Ai4YkZMfyF8cWhw4rY4RQenvlDstVx bMOOshK+5l7ONCC7YhaZgXWvu/KAJxz2jF2lUsnanGRd13N/Qndtbw/a/L/ZKB7I1ziE b2U2JZuFakbd6fZd18dH9/3e2SDVmP9r3s8KlWLjuBL5siVXx9bj8z3WuUo5YA78ShP0 SnhEZ+r2YaP2BQtQ9FQdgQL8bdRctw7DJc/OJkNZXYEoV4G/bfx4wSRCvcDZK5Jr1QDm V3GA== 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=C3IWG/JCvp9MCssIIQmcDut+b4NbRDFVx5fNug/KLCM=; b=ZnsIGnwtnq3Utwwc5aK1UzdtS7F9cDXLOy63ep8QicDNVMrvSFcOTBFf5rXm2vCz4a aHnbxfqbfnl4UzXBmoTPqxEwJr4Kd/jRFrUMh6Lw9wCx3vj4i9crnRafqqLPvBfNYJ1T kiRFkqRCzP4fuoJTU/HWzkJMtMrQQWvy/+5E+tpKRBcV4HmkU9rEbqE5ZcxBc1mBuXnw MhuP25Py/SF56HYwr7XwQyypEy0FLcD4nXlj6wpMf7d15b0srihaF0zEYTlmd6XXtL/e y6VJ1Qx2Mq2bxQmQZnv1gsdzdmEljR50HZtNkx27drCVeyLO688ZeoCG9X3KD9qnCHyr OLQw== 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 s11-20020a170902a50b00b00153b2d164cdsi18766813plq.213.2022.04.26.08.53.31; Tue, 26 Apr 2022 08:53:48 -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 S234843AbiDZLM7 (ORCPT + 99 others); Tue, 26 Apr 2022 07:12:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231584AbiDZLM5 (ORCPT ); Tue, 26 Apr 2022 07:12:57 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DB2342A01 for ; Tue, 26 Apr 2022 04:09:49 -0700 (PDT) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4KnfJk3cF5zfbD5; Tue, 26 Apr 2022 19:08:54 +0800 (CST) Received: from huawei.com (10.175.112.208) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 26 Apr 2022 19:09:47 +0800 From: Yuan Can To: CC: , , , , , , Subject: [PATCH -next] phy: hisilicon: Add resource release in hi3670_pcie_get_resources_from_pcie Date: Tue, 26 Apr 2022 11:05:43 +0000 Message-ID: <20220426110543.49726-1-yuancan@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 dggpeml500024.china.huawei.com (7.185.36.10) 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 Reference count of pcie_port and pcie_dev should be decremented when error occurs. Fixes: 73075011ffff8 (phy: HiSilicon: Add driver for Kirin 970 PCIe PHY) Signed-off-by: Yuan Can --- drivers/phy/hisilicon/phy-hi3670-pcie.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/phy/hisilicon/phy-hi3670-pcie.c b/drivers/phy/hisilicon/phy-hi3670-pcie.c index 0ac9634b398d..77c9c72d939e 100644 --- a/drivers/phy/hisilicon/phy-hi3670-pcie.c +++ b/drivers/phy/hisilicon/phy-hi3670-pcie.c @@ -567,6 +567,7 @@ static int hi3670_pcie_get_resources_from_pcie(struct hi3670_pcie_phy *phy) pcie_dev = bus_find_device_by_of_node(&platform_bus_type, pcie_port); if (!pcie_dev) { dev_err(dev, "Didn't find pcie device\n"); + of_node_put(pcie_port); return -ENODEV; } @@ -581,6 +582,8 @@ static int hi3670_pcie_get_resources_from_pcie(struct hi3670_pcie_phy *phy) phy->apb = dev_get_regmap(pcie_dev, "kirin_pcie_apb"); if (!phy->apb) { dev_err(dev, "Failed to get APB regmap\n"); + put_device(pcie_dev); + of_node_put(pcie_port); return -ENODEV; } -- 2.17.1