From mboxrd@z Thu Jan 1 00:00:00 1970 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 63B32EEAA7A for ; Fri, 15 Sep 2023 00:50:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231201AbjIOAuf (ORCPT ); Thu, 14 Sep 2023 20:50:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbjIOAue (ORCPT ); Thu, 14 Sep 2023 20:50:34 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA6EB26B8 for ; Thu, 14 Sep 2023 17:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1694739028; bh=nad9A/VbKdrfPZunawFnPzLWs8iZM5+zMuaqAp2Hnrg=; h=From:To:Subject:In-Reply-To:References:Date:From; b=GB0JMoZJMVmdf+EG39aOaj0qRSqX2rMiFxtPMzpdQqOzqowiBYyCBBXMNMD/9BuWT hTFErFF4BaLXcjc4qRQ/7PQBFd38/jrn2PyHXUhetRzyigML/7pASAGwTwnwCv8Cj+ uNXOX3YfCfRl+qNN9oU4ExH4XDEUkHnrWVt1Xay8tHoAZXf515bNBjZ5XUtAsBOXjN 1aJOVoIASQbmF1EOf40TtKIntpwkXEPTPONRgX9xjvS7GCrDO8nmVLOnlNZ+7QoE0o zOeG7Nhmec3QTAe7n0FMc7aCDnlIKzSrD2QPVpSXXMlO2Xw4EW1t6YztjAhKzt2Lcg DHsksg7ag605A== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4Rmwb83wdgz4x2b; Fri, 15 Sep 2023 10:50:28 +1000 (AEST) From: Michael Ellerman To: Tyrel Datwyler , Yuanjun Gong , Nicholas Piggin , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] powerpc: fix a memory leak In-Reply-To: <54bf92e8-f884-1567-2149-caf638ff8f68@linux.ibm.com> References: <20230914094620.3379729-1-ruc_gongyuanjun@163.com> <54bf92e8-f884-1567-2149-caf638ff8f68@linux.ibm.com> Date: Fri, 15 Sep 2023 10:50:28 +1000 Message-ID: <87il8c6yzv.fsf@mail.lhotse> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tyrel Datwyler writes: > On 9/14/23 02:46, Yuanjun Gong wrote: >> When one of the methods xive_native_alloc_irq_on_chip, irq_create_mapping >> or irq_get_handler_data fails, the function will directly return without >> disposing vinst->name and vinst. Fix it. >> >> Fixes: c20e1e299d93 ("powerpc/vas: Alloc and setup IRQ and trigger port address") >> Signed-off-by: Yuanjun Gong >> --- >> arch/powerpc/platforms/powernv/vas.c | 14 +++++++++----- >> 1 file changed, 9 insertions(+), 5 deletions(-) >> >> diff --git a/arch/powerpc/platforms/powernv/vas.c b/arch/powerpc/platforms/powernv/vas.c >> index b65256a63e87..780740b478f0 100644 >> --- a/arch/powerpc/platforms/powernv/vas.c >> +++ b/arch/powerpc/platforms/powernv/vas.c >> @@ -54,7 +54,7 @@ static int init_vas_instance(struct platform_device *pdev) >> struct xive_irq_data *xd; >> uint32_t chipid, hwirq; >> struct resource *res; >> - int rc, cpu, vasid; >> + int rc, cpu, vasid, ret; > > You can you reuse rc for the return value in the error path instead of > introducing a new ret variable. Yep, please send a v2. cheers