Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5397379rwb; Tue, 1 Aug 2023 01:39:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlFj3JQEGeCKaoZ3L9rj9dWL5pDNnx9lVu0p9g6+dfH0SKkQpP+VAS7opTvbOPTk6hOKcEc8 X-Received: by 2002:a17:903:41cf:b0:1b8:c972:606c with SMTP id u15-20020a17090341cf00b001b8c972606cmr15281311ple.57.1690879193805; Tue, 01 Aug 2023 01:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690879193; cv=none; d=google.com; s=arc-20160816; b=pgR2PWaa6LlTWmBEd1xpgSGn+RhcWZ16Velx7LkE/QurG3BYrh5zR4w9aWFU8QbI89 k4R1bn8oPQvnmblYezFVDQemu6/Vsj2V38QeZxskySK1BXYWFSyOOV/KMGY3/6x5Uk5b wqoWayziVchyzdltDJBewsP6nR0IGWCT16mqvlvwU/5XPyDtdpOJAVpGWiYA9JPVazXT 1KZhHsZPxp6Y/Swie++bMfBWsIWqcNI887QaPqInknbXKJvLz5Un3I/i4DUluF/tsRgK P3hC1qOin1d4rhUCd4U4fzB86tzIM5SQ+l3asebPmkM9MZE1xYOH4tSrBvvG63B5nqgk h2/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=06T1D2OiWyZ8C/220IaDbfZiuS+arn8q5NQkR8E9bJY=; fh=gvpZ/cMgkIUqefJbUT7ta9PSLqRT6tixtEDIOxuNpUg=; b=Ku0//9cxc5cbyL0buGPcktCBXHog6ZEmvA2Rf2vveZMgl6/UvCyJ5TqUSTRIuhg5V+ 5y7GhiGzZuuegGYzrtyy0j+UTBsoAv/uluV0zGVCIvVxoRanalbs3t/FZ0IpGdk92Fww 0sCkNMwbSwptd3AD3G+HbUQEF6phibkPEzkoNO0rp7Z8AV+BrzwS9NrmYHBbK+M7KApP qh/Q2K5h7x1+Sz11nLsbonOQBhy9bvd86E/2QfhJBlA75BP7hVp8Vr4KRCgt+y0+V0uw 9TMgq3JuLxf+H0tzm0TD+22Y2jy8jNzuJ67Fpr7fDPAfvrt6GoX/iid3s8EY/OtbpBd3 7nfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nJM+mH4Z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a17090341c800b001b845157b69si9031946ple.414.2023.08.01.01.39.41; Tue, 01 Aug 2023 01:39:53 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nJM+mH4Z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231742AbjHAIQC (ORCPT + 99 others); Tue, 1 Aug 2023 04:16:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232174AbjHAIP7 (ORCPT ); Tue, 1 Aug 2023 04:15:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB24B1FC9 for ; Tue, 1 Aug 2023 01:15:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E1AFC614A7 for ; Tue, 1 Aug 2023 08:15:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FF43C433C9 for ; Tue, 1 Aug 2023 08:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690877750; bh=rXEVIqqRyRvRsofPskVfpAkSPf5Oa6MWCD1ttlvHZYw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nJM+mH4ZZjaVjFxLIw/YSXO/LhzwkfKMNjl/zKfCbkaMYl8a/HI6K6ozeFk3KyZgV PMZ4gm07LBqt15mjMso/fcsu9BaVVT8hW/JsPe4gFerCdaHwyBdISRwaCqE/WqZx7L GmVuycGMeticbHsGxaVD+7UOBhMYpooow3G1ePh9YMZDLaAXpI4Csnu7YDPO4/Usxp 4eec2n1UTPkPrY5cieCHOWt5ONTV3JAdQH+j73u01y/BZdDbqhdR3Awas2GyWvUIMR aVNR3+tBgRpzmE6WgT625DtEym4Zm36w/Fw2onpKJD391uhTtZEEoQRpj5R2GlaCGm 4hUFtIWtJvJJw== Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5222c5d71b8so7705464a12.2 for ; Tue, 01 Aug 2023 01:15:50 -0700 (PDT) X-Gm-Message-State: ABy/qLYsda+d+5cuyava+GbHh29LdP3Ql8+x+xuvyHHEnOJiSEY0v38g 7jqbwj0toKvWaZRA8a4mDA5y8sBXV5XBzW00/Jg= X-Received: by 2002:a05:6402:695:b0:51a:5c1d:5c06 with SMTP id f21-20020a056402069500b0051a5c1d5c06mr1550663edy.42.1690877748624; Tue, 01 Aug 2023 01:15:48 -0700 (PDT) MIME-Version: 1.0 References: <20230306025308.248987-1-dzm91@hust.edu.cn> In-Reply-To: <20230306025308.248987-1-dzm91@hust.edu.cn> From: Huacai Chen Date: Tue, 1 Aug 2023 16:15:36 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] drivers: loongson: fix memory leak in loongson2_guts_probe To: Dongliang Mu Cc: Yinbo Zhu , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hi, Dongliang, Reviewed-by: Huacai Chen And please resend this patch with title "soc: loongson: fix memory leak in loongson2_guts_probe()", cc Arnd and soc@kernel.org, because that is the most appropriate list for this patch. Huacai On Mon, Mar 6, 2023 at 10:55=E2=80=AFAM Dongliang Mu wr= ote: > > drivers/soc/loongson/loongson2_guts.c:150 loongson2_guts_probe() > warn: 'guts->regs' from ioremap() not released on lines: 131,135,139,143. > > Fix this by modifying ioremap to devm_ioremap. > > Note that, this patch is not tested due to the loongson architecture. > > Signed-off-by: Dongliang Mu > --- > v1->v2: instead of modifying error handling code, directly change > ioremap to devm_ioremap. > drivers/soc/loongson/loongson2_guts.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/soc/loongson/loongson2_guts.c b/drivers/soc/loongson= /loongson2_guts.c > index bace4bc8e03b..a053e3fdae09 100644 > --- a/drivers/soc/loongson/loongson2_guts.c > +++ b/drivers/soc/loongson/loongson2_guts.c > @@ -107,7 +107,7 @@ static int loongson2_guts_probe(struct platform_devic= e *pdev) > guts->little_endian =3D of_property_read_bool(np, "little-endian"= ); > > res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); > - guts->regs =3D ioremap(res->start, res->end - res->start + 1); > + guts->regs =3D devm_ioremap(dev, res->start, res->end - res->star= t + 1); > if (IS_ERR(guts->regs)) > return PTR_ERR(guts->regs); > > -- > 2.39.2 > >