Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3644404ybz; Mon, 27 Apr 2020 20:26:43 -0700 (PDT) X-Google-Smtp-Source: APiQypLl8GsSSjGSt/pZXftiAHv6d3q5lKxRTZb+lfaKsEtUwm1ljK0Df6NFUzw2Ilgd32CvWsr6 X-Received: by 2002:a17:906:724b:: with SMTP id n11mr15387188ejk.355.1588044403095; Mon, 27 Apr 2020 20:26:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588044403; cv=none; d=google.com; s=arc-20160816; b=PJFYFOmC0XR1xMYqo49ZsK+PmXWNuj7u7xsgp4zbNq2d1bZwoU2hzRYFmfefXcWQSs pcpqAQ6FYLpGktqXgfwal1K2Ql8Dn9u5Kyb6U2uDRWmromOHZQ/049JBtklKdHCqkzod X207pdWuqPrkwDyLsaGDMMpNUrxEBhqTc1HlLvYETPD1JgVfkNcebSde0RYV1YoPsimV OOC5pJ6FPhV3lDmGFy2FN/o3AqZ6iBlseYVsFhZZCsjEOe+RX0h+Inqazqf4vmdcT5C7 AR9lqTI+0KZ58P8xwMYi3oywSF/kw5a0ADvcyEqBg3a6FBWRimG4cPJ+Dlsq84632C2T QTpw== 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=pdrvzD+DuU91+ygk7eb413XuXlCm15QQGsmxIoU0CRg=; b=jqMW+jcRlTwklPoEop92nOziWi6iUDKTxD4EBrAnGa+2ERo8GvwDSNq6hCGLw6d+3g 7GQ0dDP24tNnudylOAkbV2PM5ykneil6Mau/KtUzq3hGaPrjUsLtfmOjhblQwS5Cahed RcKTDTwp91Ing7C8AnwYn/Gy6Vzr5y/bhh8B1Z63K8L3zCZTpGTMAQlF4i/hrCreN/Be OZrvifhHzelTrSC4nQfhOmyImR8K5ci0aBq+X4Dgs7ourxVY59GRrbwoF2ZPAUP3ZlIl uLdjrcd+Jnh3mQK4QKN657DikPVQ9+B780Nj0TSp5oXWcpw6OJKC4LPp9GqcFa3Ts4Aq hrpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="fg/4Bznn"; 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 k6si863329edx.457.2020.04.27.20.26.19; Mon, 27 Apr 2020 20:26:43 -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="fg/4Bznn"; 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 S1726318AbgD1DZA (ORCPT + 99 others); Mon, 27 Apr 2020 23:25:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726271AbgD1DZA (ORCPT ); Mon, 27 Apr 2020 23:25:00 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D19AC03C1A9; Mon, 27 Apr 2020 20:25:00 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id t16so7786515plo.7; Mon, 27 Apr 2020 20:25:00 -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=pdrvzD+DuU91+ygk7eb413XuXlCm15QQGsmxIoU0CRg=; b=fg/4BznnQOB3wPtojWBAwoEZ+UaAWf3aAGVQGM7viXJ2Ke7uVbsoIZO0kIxJypVDv5 UHzFcCU5y6XQpmfaQa8x8qJzY2Z2CS5aF55ZPYtjDQYubHol+2B+QV4NP6l78BVP+5Vr DY/uJ2BdGA+RE1oiK/LZTJMlfTluihtFJtGFvfz1QvhbImtdVwWW7476eHC0QROeVW4m gi73+OOo7sYuy+XQKLFGORd7tmvB1/fVTBZZylEyuF2EtFooYvBAHQ/+wA0V5aAOYmVC L76Z+UZrRLgsWX+VbH5sltYYcPj4I+asv/fxIItuV0tBZeb1V/8dCkLwiatm8MpxQDbJ y1Jg== 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=pdrvzD+DuU91+ygk7eb413XuXlCm15QQGsmxIoU0CRg=; b=qmqkiYUFjnW/oWDoNolS5pINW58v40zPGB2OGJH8LbAn+s1I9LbILkc2UQ/ul2BByA PwGoGnzFNfREFfYjUBi///AFAkeFHc/x0u8gRveTb0ltnapfXlCV0vXab15Xl+OrBg4l LLXxQ9hirSVfOl5a/9FiFh5VCX/cctzOO6R45jwvH+J6OTrveqFtX78Nuylbz8PhM323 1ewUmEM81IjU4Knrl8RnVyuF/XSqhcrMdKdCtKPpMmG0aw14w0LqdnANlNF0ZyHEVVZw GQvF2fMol0Nky7lhoSd1/AGBr9Y/OHBx+8p1MoYLVvD+w0mQNpKclJ5Wb7Q8LgM2Z/Ud YdhQ== X-Gm-Message-State: AGi0PuaHV+ZIc3hWu6cwxx1zvKquZK48Jxi/Prkz2hbVANjAJ0KpatX9 gsvdOu583RVMQDkEReoQZJtDyiaX X-Received: by 2002:a17:902:d34a:: with SMTP id l10mr26700867plk.234.1588044299733; Mon, 27 Apr 2020 20:24:59 -0700 (PDT) Received: from localhost ([89.208.244.169]) by smtp.gmail.com with ESMTPSA id r63sm13769546pfr.42.2020.04.27.20.24.58 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Apr 2020 20:24:59 -0700 (PDT) Date: Tue, 28 Apr 2020 11:24:53 +0800 From: Dejin Zheng To: Andy Shevchenko Cc: "David S. Miller" , Paul Walmsley , Palmer Dabbelt , Nicolas Ferre , yash.shah@sifive.com, netdev , Linux Kernel Mailing List Subject: Re: [PATCH net v1] net: macb: fix an issue about leak related system resources Message-ID: <20200428032453.GA32072@nuc8i5> References: <20200425125737.5245-1-zhengdejin5@gmail.com> 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 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. > > Fixes: c218ad559020ff9 ("macb: Add support for SiFive FU540-C000") > > Cc: Andy Shevchenko > > Signed-off-by: Dejin Zheng > > --- > > drivers/net/ethernet/cadence/macb_main.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c > > index a0e8c5bbabc0..edba2eb56231 100644 > > --- a/drivers/net/ethernet/cadence/macb_main.c > > +++ b/drivers/net/ethernet/cadence/macb_main.c > > @@ -4178,7 +4178,7 @@ static int fu540_c000_init(struct platform_device *pdev) > > if (!res) > > return -ENODEV; > > > > - mgmt->reg = ioremap(res->start, resource_size(res)); > > + mgmt->reg = devm_ioremap(&pdev->dev, res->start, resource_size(res)); > > if (!mgmt->reg) > > return -ENOMEM; > > > > -- > > 2.25.0 > > > > > -- > With Best Regards, > Andy Shevchenko