From patchwork Tue Nov 29 01:50:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Yongjun X-Patchwork-Id: 13058103 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 01F20C43217 for ; Tue, 29 Nov 2022 01:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=MQlF8Bl8HA2i+0tCDIohKgU0nzNMWMuKYCaAkjvk2QU=; b=MCFGegyDG1Osvg BFFstxKAaJKIzXqYqGFmpLBDmI+NUFm+Pf/zHpBBCf9cBTLizG0zbzFQ5K6Um05b2hGzHoyA6HZwa eq7ou1vR1Pswje85TBHpFbBGkSoOy4C0wUBuERMtByRiTeEsuyzkKdoEV57N/S0YX8rpJG4B6WZ9J eGoxZdmPlkOsWApXHvSCspsY7oXsJI61qA7ES84/T10EeCIVK8Lk4ZCGbhnGxMJmVvltWqWJSfCP9 2ucvgDhhW/Gas3g+0+ba/c/6W0ZsIe+j1nmjaLPG/7we+QYoic03sVHhrcxsTsdTK8JClSg4Ashz6 ux/v4azEOR43vpZmB9fQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozpna-0053JM-0G; Tue, 29 Nov 2022 01:52:38 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozpnW-0053HN-O0 for linux-arm-kernel@lists.infradead.org; Tue, 29 Nov 2022 01:52:36 +0000 Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NLlgp04XCzHwFv; Tue, 29 Nov 2022 09:51:49 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 29 Nov 2022 09:52:30 +0800 From: Zheng Yongjun To: , , , , Subject: [PATCH] soc: fsl: qe: Fix refcount leak in par_io_of_config Date: Tue, 29 Nov 2022 01:50:12 +0000 Message-ID: <20221129015012.61847-1-zhengyongjun3@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221128_175234_973432_1C90A929 X-CRM114-Status: UNSURE ( 7.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on error path. Add missing of_node_put() to avoid refcount leak. Fixes: 986585385131 ("[POWERPC] Add QUICC Engine (QE) infrastructure") Signed-off-by: Zheng Yongjun --- drivers/soc/fsl/qe/qe_io.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 diff --git a/drivers/soc/fsl/qe/qe_io.c b/drivers/soc/fsl/qe/qe_io.c index a5e2d0e5ab51..e26836315167 100644 --- a/drivers/soc/fsl/qe/qe_io.c +++ b/drivers/soc/fsl/qe/qe_io.c @@ -159,11 +159,13 @@ int par_io_of_config(struct device_node *np) pio_map = of_get_property(pio, "pio-map", &pio_map_len); if (pio_map == NULL) { printk(KERN_ERR "pio-map is not set!\n"); + of_node_put(pio); return -1; } pio_map_len /= sizeof(unsigned int); if ((pio_map_len % 6) != 0) { printk(KERN_ERR "pio-map format wrong!\n"); + of_node_put(pio); return -1; }