Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2736053ybz; Mon, 27 Apr 2020 03:37:51 -0700 (PDT) X-Google-Smtp-Source: APiQypKSwE1LbEt7zSwFjpaNbHUbXt4yQoegSRo8yT5XtTQU1O959sqhvEklzfIxGhW5EWHMRniy X-Received: by 2002:a50:e841:: with SMTP id k1mr18544238edn.245.1587983871301; Mon, 27 Apr 2020 03:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587983871; cv=none; d=google.com; s=arc-20160816; b=VVWFOCGJu4K8LaHfOHjNicHfMzRIa6l7k1SJsVZ/kgoVgCLLO4iTRCoGhDLsCdJ1JG oJGGiZSmTI515HIghBPr5tIW4MmEkEIHPz35sFeyZOPTgW4HIJ8z/eRznzBqWL0q869d mjODSpzkMj8L44pHajHiOz0VUBYXgeAjMM3sr+kqcJZHZTyRh8e3I8Q9kr0YHjG5lyPv PA39d2IRAVPT0LCLb3CSHISIz5q6WJzxaS3z9htRBQEiwoR3gr6QqWwB5YsYSK3VxEmO P/7jYg03FE44obcv6vIx8s6Te01QDbsxcvrxtRNSoLOI2cubYdRwaH7eSLmvOwomb5qY wkog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/yQSlVE7PnqopQQf8iulieHvAebBl49JpRFSg6plQOM=; b=ylg8iqWni0rYR+5C+SRjOOdELquafVyZZ2VQb1pabE/h7/3C5ZAHIg3a98QtqCIZwc 4Wc515GYSl5OnGuZSi/5jfw75wBolBvXQSCPPsahlpYRnaYE631lSZUW088QQdXJfUe9 8ye1qVEwY9g+gPVuUmDl+BKTQFNlZBm0EvW5QCuX1VJF1dDBZ+kVSJl+3gVtD9pjH7cD nB7f5B8V7dRw9ac1CljcA15s8bPBFqxTM6DPM9kIyC9t3r6crW/Ls6cxMKcQxIZQUfOx 8nEUg4utrT84aF2XoONDhedcVE3DYku0+aOSaEpoxtemkuBR1cAOhzGsSOCc0cYpy9J8 xRIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=svEuRkyX; 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 m29si7748205eda.592.2020.04.27.03.37.28; Mon, 27 Apr 2020 03:37:51 -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=svEuRkyX; 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 S1727061AbgD0Kdt (ORCPT + 99 others); Mon, 27 Apr 2020 06:33:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726504AbgD0Kdt (ORCPT ); Mon, 27 Apr 2020 06:33:49 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED004C0610D5; Mon, 27 Apr 2020 03:33:48 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id z1so7129950pfn.3; Mon, 27 Apr 2020 03:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/yQSlVE7PnqopQQf8iulieHvAebBl49JpRFSg6plQOM=; b=svEuRkyXeWE3IGEar5EHdocILyDaW+N13jTvaXBDoiDY7QzRabNPcqPxk2izwFfPrS jvDbUeVC5CoKypPJaGwxGalr9dnagxExe7bIiHksHfBch3vtRWBCIEYTgyBM83QqYkz5 YxeEJh/bzDTpa02BND1fjJLof2J+ssnoQaXbNs732qWb1yyOPp1QbwGEv/SFEq+tUmuJ VywvW5hrMuOdMz27XswGzFq7FO48vtQ7AkbuOn9dm5p6ATj1UH0ErQ/pU3bWM5YogOfU fwyve8vTb692wz5hPxqwJiMgWLcz+2rUjmamPzMNrc5j0uGbaf1e6ngiPzMwAdV8NLwN IthA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/yQSlVE7PnqopQQf8iulieHvAebBl49JpRFSg6plQOM=; b=sia8Kndqs18gloYktSSudrjF8kBjU07sudqIfba25fJNsTVmtdzZXB4MJccS9vU8Eh no4VPtWPrAKO96UkUnbLgqyfWln9vfD03Yacwz5WpD2IejJTLk1BUfMEAxVX1U1+d/LR EmrihH8oI7TUSyutjEstVtJHwwwMn5Ot85LGmMJAGBWC/rNkTEkOJRaXbmIza+70YTh6 PY5m9Oyq/WIRWlUI9APswT3tf+Ud9NI8r9P/8V/c1BMb1K3QnvaH9PRuQ77exiqXqF9M w+pa8puTPWybjlXJbRo3khRtE+RiZbogD5UkvrTsJDeI1/P56P/TRVSXweBU3JKuHAtu dLYQ== X-Gm-Message-State: AGi0PuYMmNnHva3RtLdFwTVzI12TFs5iUSp2b222nK81oZ9JjFOt/cvA e9V41FOdYwWpQnKTed/5FsX67s2Yz7lrNd6j/LE= X-Received: by 2002:a63:1c1:: with SMTP id 184mr23267416pgb.203.1587983628496; Mon, 27 Apr 2020 03:33:48 -0700 (PDT) MIME-Version: 1.0 References: <20200425125737.5245-1-zhengdejin5@gmail.com> In-Reply-To: <20200425125737.5245-1-zhengdejin5@gmail.com> From: Andy Shevchenko Date: Mon, 27 Apr 2020 13:33:41 +0300 Message-ID: Subject: Re: [PATCH net v1] net: macb: fix an issue about leak related system resources To: Dejin Zheng Cc: "David S. Miller" , Paul Walmsley , Palmer Dabbelt , Nicolas Ferre , yash.shah@sifive.com, netdev , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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()? > 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