Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp79110rwe; Tue, 18 Apr 2023 17:59:02 -0700 (PDT) X-Google-Smtp-Source: AKy350asfvAMcU98H175B5FD+Td/kCzkuhtHt/uYlXeX9VS5F2mIGER7c0zTNVRGUZ/xiMYh3SqN X-Received: by 2002:a17:902:e5c1:b0:19f:a694:6d3c with SMTP id u1-20020a170902e5c100b0019fa6946d3cmr4605769plf.55.1681865942341; Tue, 18 Apr 2023 17:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681865942; cv=none; d=google.com; s=arc-20160816; b=inUBF/0+m7KAJq2WAaIDAVEjAZK0waQRtexCHcgskdqWv4EtaCDsjQDPU1+7pOdBmU brBpzw57my7LmfBJWgG8hgiNNWWJ1BMflFDb/V+3xrT2PhB2XuWZnUnPWoRzAZWEiN1N qcSLN2T4jcLExKymNtvVDjbq2dgIxGFINwBDRWBu0Ft0hXk0O1bfqJiKTCj6sfXnzA2W +dIgVyRU6UlcIYM0nKLVqruiLq+CCaVy2mYNM1kb6AhFhrBJJZfYZEo6BYecnOMkHSbC ISJRf4OtyS682EZlHeFElrx6QZ4f7oz9REqozILzi4FWFwjxd9hClXQK58XLl/mLTKFD 6+2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=UxY/m5RcDGMqWE0VVcIgfNwwx4bqBBU7XeHPG4CW82A=; b=GmxPt9ttQxPkDO/QwFs4DSMmV5q0PQcsLJW6hrohiGgn5CwWBdiKHGXvMDG0rf5RPU UQIylb1/KSdXYbMTIYySZmBhMIgAb4m64KIvq+DgbqDpH5Xw2uThnDE84UNiqxFlxoxV kRg8Khg9+fNOOSB0YTpF03voUisnZ4ikx+x3/+cPV1dDoCmQ5THFyOs28iT+NbGvwI7O ISj4WN/AjxN7uIRGy0oj0Fi1U5IpupeoOozIZJ9Bj9YXFXGNba9pRgamq504MhxGWP/s wfIP5yyYiyvX/9O/y4Tw8tvGBvwOYQZ74aZQmXtNd7y1YuhB/wBogp8u3PVHRzuXNlBd eOcQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j3-20020a170903028300b001a1b5e2deb0si16300166plr.334.2023.04.18.17.58.51; Tue, 18 Apr 2023 17:59:02 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230500AbjDSA5S (ORCPT + 99 others); Tue, 18 Apr 2023 20:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbjDSA5R (ORCPT ); Tue, 18 Apr 2023 20:57:17 -0400 Received: from hust.edu.cn (unknown [202.114.0.240]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D928A250; Tue, 18 Apr 2023 17:57:06 -0700 (PDT) Received: from [IPV6:2001:250:4000:5113:2570:678:bb4e:e0e8] ([172.16.0.254]) (user=dzm91@hust.edu.cn mech=PLAIN bits=0) by mx1.hust.edu.cn with ESMTP id 33J0t72O020463-33J0t72P020463 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Wed, 19 Apr 2023 08:55:09 +0800 Message-ID: <918bf8b1-6da6-943b-3cbe-e15a24c9de6f@hust.edu.cn> Date: Wed, 19 Apr 2023 08:55:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] clk: imx: clk-imx8mm: fix memory leak issue in 'imx8mm_clocks_probe' To: Stephen Boyd , =?UTF-8?B?5ZGo5biI5b63?= Cc: abel vesa , bai ping , fabio estevam , michael turquette , nxp linux team , peng fan , pengutronix kernel team , sascha hauer , shawn guo , hust-os-kernel-patches@googlegroups.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, hao luo References: <20230413032439.1706448-1-u201911681@hust.edu.cn> <25b06794ffb595229019640e10f256fd.sboyd@kernel.org> <5e18370b.3c8a8.1877d7fc98a.Coremail.u201911681@hust.edu.cn> <86398a778336846688c33a737e2a9ae2.sboyd@kernel.org> From: Dongliang Mu In-Reply-To: <86398a778336846688c33a737e2a9ae2.sboyd@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-FEAS-AUTH-USER: dzm91@hust.edu.cn X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_PASS,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 On 2023/4/19 03:57, Stephen Boyd wrote: > Quoting 周师德 (2023-04-13 19:02:19) >> >> >>> -----原始邮件----- >>> 发件人: "Stephen Boyd" >>> 发送时间: 2023-04-14 03:06:59 (星期五) >>> 收件人: "Abel Vesa" , "Bai Ping" , "Fabio Estevam" , "Michael Turquette" , "NXP Linux Team" , "Peng Fan" , "Pengutronix Kernel Team" , "Sascha Hauer" , "Shawn Guo" , "Zhou Shide" >>> 抄送: hust-os-kernel-patches@googlegroups.com, "Zhou Shide" , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Hao Luo" >>> 主题: Re: [PATCH] clk: imx: clk-imx8mm: fix memory leak issue in 'imx8mm_clocks_probe' >>> >>> Quoting Zhou Shide (2023-04-12 20:24:39) >>>> The function imx8mm_clocks_probe() has two main issues: >>>> - The of_iomap() function may cause a memory leak. >>>> - Memory allocated for 'clk_hw_data' may not be freed properly >>>> in some paths. >>>> >>>> To fix these issues, this commit replaces the use of of_iomap() >>>> with devm_of_iomap() and replaces kzalloc() with devm_kzalloc(). >>>> This ensures that all memory is properly managed and automatically >>>> freed when the device is removed. >>>> >>>> In addition, when devm_of_iomap() allocates memory with an error, >>>> it will first jump to label "unregister_hws" and >>>> then return PTR_ ERR(base). >>>> >>>> Fixes: 9c71f9ea35d7 ("clk: imx: imx8mm: Switch to clk_hw based API") >>>> Fixes: ba5625c3e272 ("clk: imx: Add clock driver support for imx8mm") >>>> Signed-off-by: Zhou Shide >>>> --- >>>> The issue is discovered by static analysis, and the patch is not tested yet. >>> And you're not coordinating with each other? >> What do you mean by "coordinating with each other"? >> > I see two patches to the same driver from the same university on the > list. Preferably you coordinate and decide who will fix what smatch > warnings. Hi Stephen, As their advisor, I coordinate and assign smatch warnings to each student. I double check our assignment table: drivers/clk/imx/clk-imx8mn.c:612 imx8mn_clocks_probe() warn: 'base' from of_iomap() not released on lines: 612. drivers/clk/imx/clk-imxrt1050.c:154 imxrt1050_clocks_probe() warn: 'pll_base' from of_iomap() not released on lines: 108,154. drivers/clk/imx/clk-imx8mm.c:619 imx8mm_clocks_probe() warn: 'base' from of_iomap() not released on lines: 403,619. drivers/clk/imx/clk-imx8mq.c:611 imx8mq_clocks_probe() warn: 'base' from of_iomap() not released on lines: 399,611. There are four similar warnings from your subsystem. If I understand correctly, two students are patching issues from different probe functions in the different files since we assign all issues in one file to one student. Maybe you mix clk-imx8mn (Hao Luo) and clk-imx8mm(Shide Zhou). They only differ in one char. If I miss anything, please let me know. Next time, I will ask one student to fix the issues in one subsystem. This can simply the effort spent by other student. Dongliang Mu >