Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4234306ybz; Tue, 28 Apr 2020 07:57:04 -0700 (PDT) X-Google-Smtp-Source: APiQypJk2YH+nmt0wcCeBm6lJmLw5xoN+8bUJf+JXAtxOMg/7kBXQPmT42AYMxI1d/z/iCTwHM+g X-Received: by 2002:a50:b412:: with SMTP id b18mr22479349edh.42.1588085824171; Tue, 28 Apr 2020 07:57:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588085824; cv=none; d=google.com; s=arc-20160816; b=WhCEo6sGP7DtGsv7D9eTwO6OdUXe7jkobAnWWXpAxhBYFKjAYojDLtlbf6dkdjgfeo TeTqIO0Yh3mFbViMRGtl7CYQyK01oz6CBZ5RWpALOUo6g19aeaIunyIKDc4tMEvsdZE+ yu/N8ZgskKFKiZynAC/9AWWcx4bhFhS4KboU6tEr+jWipoXcHDAM5dvxtGJ8ZSSxvv0K iSoVsjau3gjTejWyE5Aul9ukPRatFEHfvpt7/KzosPRInLwV5YzYTqa+YzOl1FNzHody OOmIs/aEonmzeyc1GAswQIF43vv7TlDnwnrWhNppOSZrDN/LG3eTlzDMqEWmb82dZ8z4 FjGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/JpZ0+eTyvNRtNOYk4xxR3kczphsAY370jAlUixwt7E=; b=Pu6OQrOlRHJ66GryZc7V5Eq+H182juaUvPlErqycOcezlS+8aG0Za8WJyyiBU1GA5f z6kQ5vVXFch2vjongVgRx7H3qB4Eg9RANFvCnUyERb7rkxodcvGKC+MSM7pjAhVwpbtU I8WMQ8BxJfcmJHdTXSLj6LSGnOx0AY/vUkOgSG1dtbkho4Mw8qNBsEGgw6rZQhg2XUYK 2QhH3Qp9h02+lnQmybXwvP6IAVco7LQbxnpsJELn3x6lV9o9zncxMRj59mFlfu2p9n55 L9p17HWe10mabAIfsboGKN/A2F+m+xC9KZJxkjAVu9NvxVRleN4jkv/mK0PaPr9XJjLo AYww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UAyjAIan; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si1733020edw.490.2020.04.28.07.56.39; Tue, 28 Apr 2020 07:57:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UAyjAIan; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728032AbgD1OxF (ORCPT + 99 others); Tue, 28 Apr 2020 10:53:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727775AbgD1OxE (ORCPT ); Tue, 28 Apr 2020 10:53:04 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8064AC03C1AB; Tue, 28 Apr 2020 07:53:03 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id p8so10428563pgi.5; Tue, 28 Apr 2020 07:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/JpZ0+eTyvNRtNOYk4xxR3kczphsAY370jAlUixwt7E=; b=UAyjAIan1d3dX0IGuqchgOq9ZJxc+1lIdjWmNns+yfgfuI9rJ8BpOvKq6w9S7tvB9B lLaadMowzbiCMvG5JRaPPT2L/hk97E2Cg9e4glNhJTGWIm+SHU5YSb5eT6eALpNuFKv+ 8T6aN/cfUtXyX8sOwX+1abnlj8Z829PzZdUvcpNTyOG1GHxna/TV2gSedASndyIQykIX 0ykK1jTkLm79a1tXkNpPGC/DUaHIjN33R4XY7YM+jCm5hR4Wmc8Ddv9htBSpxXJy2Mlq jLZ6JOvN4eRgZ5K/dnQ5gnQS+KPQOz7GBtYYq+8sjKPZBXDeL/bZJUBif8PmCgmMhpzr vW8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/JpZ0+eTyvNRtNOYk4xxR3kczphsAY370jAlUixwt7E=; b=Nxis812MwUoBqc0tNuiVc/ZCBgCTZNJrWM9dmQ6Rykyc+Szub0kNGinGz9e4qDS7iF 8evWgKeUZnXKw8RzBA5CdNLBZCzvpgRaZ/FDUr76bcH1+JEMIPHhf86DTTVuknx1FIwM SNAQ9qI3MeOotmhidPO3PB50hFrq09u5sSBoue96mva1r4hmXWR+wFblS44g5qYaW+RD f8cuozJq316svSTLqBXyCT9BXmCAY1VplEovKkdo/zbqoQp/gDLh5hTRCbfxtVA7UrSY 8UHjeFZ3fSKuiJg5NJzAyvWochdj/aDsPziK/LgNlliixwUNwYPdz9Fb4sy9lwqtGkjf YnIQ== X-Gm-Message-State: AGi0PuYFhtO1FOPHDTpPtRREC7ZT/C5ojnY7t/03xAin78de55KUaiUw taqBbb1mGufR3XdJ9gvbqwc= X-Received: by 2002:a62:7515:: with SMTP id q21mr31848066pfc.1.1588085582953; Tue, 28 Apr 2020 07:53:02 -0700 (PDT) Received: from localhost ([89.208.244.169]) by smtp.gmail.com with ESMTPSA id bg6sm2223231pjb.21.2020.04.28.07.53.01 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Apr 2020 07:53:02 -0700 (PDT) Date: Tue, 28 Apr 2020 22:52:57 +0800 From: Dejin Zheng To: Andy Shevchenko Cc: Nicolas Ferre , "David S. Miller" , Paul Walmsley , Palmer Dabbelt , yash.shah@sifive.com, netdev , Linux Kernel Mailing List , Claudiu Beznea Subject: Re: [PATCH net v1] net: macb: fix an issue about leak related system resources Message-ID: <20200428145257.GA3622@nuc8i5> References: <20200425125737.5245-1-zhengdejin5@gmail.com> <20200428032453.GA32072@nuc8i5> <20200428131159.GA2128@nuc8i5> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 28, 2020 at 05:04:32PM +0300, Andy Shevchenko wrote: > On Tue, Apr 28, 2020 at 4:12 PM Dejin Zheng wrote: > > On Tue, Apr 28, 2020 at 10:42:56AM +0200, Nicolas Ferre wrote: > > > On 28/04/2020 at 05:24, Dejin Zheng wrote: > > > > On Mon, Apr 27, 2020 at 01:33:41PM +0300, Andy Shevchenko wrote: > > > > > On Sat, Apr 25, 2020 at 3:57 PM Dejin Zheng wrote: > > > > > > > > > > > > A call of the function macb_init() can fail in the function > > > > > > fu540_c000_init. The related system resources were not released > > > > > > then. use devm_ioremap() to replace ioremap() for fix it. > > > > > > > > > > > > > > > > Why not to go further and convert to use devm_platform_ioremap_resource()? > > > > > > > > > devm_platform_ioremap_resource() will call devm_request_mem_region(), > > > > and here did not do it. > > > > > > And what about devm_platform_get_and_ioremap_resource()? This would > > > streamline this whole fu540_c000_init() function. > > > > > Nicolas, the function devm_platform_get_and_ioremap_resource() will also > > call devm_request_mem_region(), after call it, These IO addresses will > > be monopolized by this driver. the devm_ioremap() and ioremap() are not > > do this. if this IO addresses will be shared with the other driver, call > > devm_platform_get_and_ioremap_resource() may be fail. > > I guess request region is a right thing to do. If driver is sharing > this IO region with something else, it is a delayed bomb attack and > has to be fixed. > > I did encounter IO address sharing, for example, some registers are shared by both PHY and USB controllers on Tegra SoCs. See link[1] for details. If many people think that devm_request_mem_region() should be added here, I will send patch v2 and convert to use devm_platform_ioremap_resource(). Thanks very much! link[1]: https://patchwork.ozlabs.org/project/linux-tegra/patch/20200127135841.17935-1-zhengdejin5@gmail.com/ BR, Dejin > > > -- > With Best Regards, > Andy Shevchenko