Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp810664ybz; Wed, 22 Apr 2020 08:23:58 -0700 (PDT) X-Google-Smtp-Source: APiQypIGMqqduoqYJF1oMizAsN6ycLb/S6064yPu4SZyKlPfvDq4oBuJYAbjFktYk6zRdpWI9F8L X-Received: by 2002:a05:6402:1773:: with SMTP id da19mr23550332edb.2.1587569038299; Wed, 22 Apr 2020 08:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587569038; cv=none; d=google.com; s=arc-20160816; b=Tig4rQ82a+LM2axEVPShj9h5bWrg1qowtKlHKFk8vt6+aOrbQaIZ2FhrIKa2wpbPIm 2RgyBkBkRuoR1yAVoxidFNaPnrSEnbRlUe6tgqZncJi/sVriLJupBW4SvfQcLigkdfFD JbtwDRE1nAWMEx+BBN7YD436To6teFRPhtpZ+nPbpGFYEKwdmL5JpV/3RjIwABwPOtP9 59EgDoT6MbZ/1uA0ZzQh6a6mKNo/hKEuf6KanTpClmmI+5wf8TIzbGbsTjfSHWqP3j8V 1OHqfe99vAAfOzawHxuFawR7YLg6u/UyhlaUWI1XDJQq9e6VybbAtJnEv2sh2WxxMQUg +FpA== 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=HG3yYEiNc0envK1euxexUufAAl4nbvpE6zokSUWiokM=; b=l72xev2kge3DYgSx9E9W2HzREeF7wvKlSZTssCiI63nZ30tOArD2iTSkFYy6r/iYCs BP4mqEuVndph64xKKFL1pFK+zA1iG6o7/XNcjO6acG2/ZjpW0hmOHrvcu7ryjkhcU2JE 4L33UyMQ/JUt7pbFsU+ZLblM5ty5PnGuczGuqZ6CRiitHUo8b3H2lVpqDYW2SFXu0nVv bSCYgMIVwA/8yPXsNAbdtEOMHsTMQvKiFuq3uoFv62z794Q/qA+6rCSQrRjZG79tQxk+ szQNakfK5y/VDL6U5bK6u6QMD+LgLdxdrXfxkb/+qpKX/wpqNSe6IuvOwpNRtMJ+b/93 8HTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nZzzMniS; 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 bq12si3525342ejb.472.2020.04.22.08.23.32; Wed, 22 Apr 2020 08:23:58 -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=nZzzMniS; 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 S1726422AbgDVPVu (ORCPT + 99 others); Wed, 22 Apr 2020 11:21:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726240AbgDVPVt (ORCPT ); Wed, 22 Apr 2020 11:21:49 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62386C03C1A9 for ; Wed, 22 Apr 2020 08:21:48 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id q18so1232589pgm.11 for ; Wed, 22 Apr 2020 08:21:48 -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=HG3yYEiNc0envK1euxexUufAAl4nbvpE6zokSUWiokM=; b=nZzzMniSbj02OzHpHPqt7kEflsYgvSeEH9cTwn32djvqykD4v7ut2HI16jk3LX5r1m iGJjGN6nX4/mbNsBmDdw0/GVUxyLLmkkigSgSw1+asfeW49OyLUMk/Dt2QmHRTAgKHTS B1kmamcknz9dE0f2mrkp6MSfyryWNo0kaB9qEPmQzlI9ASonUsbSIQSf1XI+oK/44n8+ FxFctYO1yg0MQxAHmqMb+igSj2MkWzVBP2KAG2cplRraTSkWMjMmFTPEuI59rtJ4YIn1 NTPLjH6j4PDkayI4MHAtVfOe0VCbXyJou0UJcCJXkRbUUmTbwVZ9Lqwbh95+amDK5ISD SoJQ== 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=HG3yYEiNc0envK1euxexUufAAl4nbvpE6zokSUWiokM=; b=jt1DwU1+u4PjvZ03/+aMGK25nFZvyUbWq/vreGaF+dVjNEZuPXRTR652riitdmKpni lvELppjTB4uKSy5zii9KEUK1VobuvyxB3QnumF8JneDuvvIxCo9sHm6cJ0mVrsZ1CYsN e5vAPic6Q2f4OCHdsII/HuAAIQgfDTNizRTpIgISAbxU8L9VQmWMYlleIfHHnu50bO0Y sApH40ELAuWQyNuwKvcK6wIvXAAnQXx9vU4osCrF55ACrj9ouWfLL1zZVh3+7aKt4e5S RSXxR4ZCkcqvO/N0rcn8FmAO9XwbJUlsZEnG315MJ90Zt/Gh2NjYkwIJpueb6ncNv9lH oFyg== X-Gm-Message-State: AGi0PubJLmZryL4nSVPp126lbvYesnBx7JBOtnmS9DidoznUE9U7drz8 lJhlM1zy1lvqL3vrt9TlGy4= X-Received: by 2002:a63:d40a:: with SMTP id a10mr25840974pgh.53.1587568907934; Wed, 22 Apr 2020 08:21:47 -0700 (PDT) Received: from localhost ([89.208.244.140]) by smtp.gmail.com with ESMTPSA id 79sm5468092pgd.62.2020.04.22.08.21.46 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Apr 2020 08:21:47 -0700 (PDT) Date: Wed, 22 Apr 2020 23:21:42 +0800 From: Dejin Zheng To: Andy Shevchenko Cc: kraxel@redhat.com, David Airlie , Daniel Vetter , virtualization@lists.linux-foundation.org, dri-devel , Linux Kernel Mailing List Subject: Re: [PATCH v1] drm/bochs: fix an issue of ioremap() leak Message-ID: <20200422152142.GA26943@nuc8i5> References: <20200421164543.16605-1-zhengdejin5@gmail.com> <20200422135215.GA25950@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 Wed, Apr 22, 2020 at 05:40:51PM +0300, Andy Shevchenko wrote: > On Wed, Apr 22, 2020 at 4:52 PM Dejin Zheng wrote: > > > > On Tue, Apr 21, 2020 at 08:24:24PM +0300, Andy Shevchenko wrote: > > > On Tue, Apr 21, 2020 at 7:45 PM Dejin Zheng wrote: > > > > > > > > It forgot to call bochs_hw_fini() to release related resources when > > > > bochs_pci_probe() fail. eg: io virtual address get by ioremap(). > > > > > > Good start, although I think the best is to switch this driver to use > > > pcim_*() functions and drop tons of legacy code. > > > > > Andy, thanks for your encouragement, I think we might be able to fix this > > issue first, after that, drop tons of legacy code by pcim_*() functions. > > Do you think it is ok? > > It's really up to maintainer. I'm not the one here. > Thanks Andy. Hi Gerd: I am a newbie, andy gave me some directions to submit the patch, eg: check ioremap leak. At this time, I found that the bochs driver may have similar problems, so I submitted this patch, then, Andy said the best is to switch this driver to use pcim _ * () functions and drop tons of legacy code. I think we might be able to fix this issue first, after that, drop tons of legacy code by pcim_*() functions. Can you give me some suggestions? thank you very much! BR, Dejin > > > > Fixes: 81da8c3b8d3df6 ("drm/bochs: add drm_driver.release callback.") > > > > CC: Andy Shevchenko > > > > Signed-off-by: Dejin Zheng > > > > --- > > > > drivers/gpu/drm/bochs/bochs_drv.c | 1 + > > > > 1 file changed, 1 insertion(+) > > > > > > > > diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c > > > > index addb0568c1af..210a60135c8a 100644 > > > > --- a/drivers/gpu/drm/bochs/bochs_drv.c > > > > +++ b/drivers/gpu/drm/bochs/bochs_drv.c > > > > @@ -138,6 +138,7 @@ static int bochs_pci_probe(struct pci_dev *pdev, > > > > return ret; > > > > > > > > err_unload: > > > > + bochs_hw_fini(dev); > > > > bochs_unload(dev); > > > > err_free_dev: > > > > drm_dev_put(dev); > > > > -- > > > > 2.25.0 > > > > > > > > > > > > > -- > > > With Best Regards, > > > Andy Shevchenko > > > > -- > With Best Regards, > Andy Shevchenko