From patchwork Sun May 22 13:44:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 12858161 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06D78C433F5 for ; Sun, 22 May 2022 13:44:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343889AbiEVNoZ (ORCPT ); Sun, 22 May 2022 09:44:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239610AbiEVNoY (ORCPT ); Sun, 22 May 2022 09:44:24 -0400 Received: from smtp.smtpout.orange.fr (smtp03.smtpout.orange.fr [80.12.242.125]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8788E17E33 for ; Sun, 22 May 2022 06:44:22 -0700 (PDT) Received: from pop-os.home ([86.243.180.246]) by smtp.orange.fr with ESMTPA id slsYnY5CQ5ohRslsYnnhLI; Sun, 22 May 2022 15:44:21 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 22 May 2022 15:44:21 +0200 X-ME-IP: 86.243.180.246 From: Christophe JAILLET To: dan.carpenter@oracle.com, Huacai Chen , Jiaxun Yang , Thomas Gleixner , Marc Zyngier Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-mips@vger.kernel.org Subject: [PATCH] irqchip/loongson-liointc: Fix an error handling path in liointc_init() Date: Sun, 22 May 2022 15:44:17 +0200 Message-Id: <1c4e81eda5f9651f581f1554629d334f1afda841.1653227039.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org If a of_property_match_string() call fails, we still need to release some resources. Add the corresponding goto instead of a direct return. Fixes: 807e93d0ecbb ("irqchip/loongson-liointc: Add ACPI init support") Signed-off-by: Christophe JAILLET --- drivers/irqchip/irq-loongson-liointc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c index ff3cb5b05710..2227b702a81d 100644 --- a/drivers/irqchip/irq-loongson-liointc.c +++ b/drivers/irqchip/irq-loongson-liointc.c @@ -185,8 +185,10 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision, int index = of_property_match_string(node, "reg-names", core_reg_names[i]); - if (index < 0) - return -EINVAL; + if (index < 0) { + err = -EINVAL; + goto out_iounmap; + } priv->core_isr[i] = of_iomap(node, index); }