Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1963144ybz; Thu, 23 Apr 2020 09:08:11 -0700 (PDT) X-Google-Smtp-Source: APiQypLLwYmTQmb4y46qxal4TZ4b9Od+laeAm+z6g3oz6Cl+GtTXSk0rrpj6FTUMBmqb16dVPRNX X-Received: by 2002:a17:906:4eda:: with SMTP id i26mr3364054ejv.180.1587658091288; Thu, 23 Apr 2020 09:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587658091; cv=none; d=google.com; s=arc-20160816; b=Gg+ABXTOdsO00hDsPTdWjCQSnRiolIaPZX/zns15ZeZMFvjY876dhBTQ3S9zlZM7no LG3+QC9ZLJTZ9G8E/eCCZNnAETgCFxGKla8xgUtLWoRsoFctk7zCwFNk2AZnqv7Lu7iK 0H5g0xIwINsOp+434eF0eBkspwXIoaa2DXylX9HvyR8GNsYGzW/1dgk1HE9n8kgssRG5 G+VNk3n1geo/3XLBT4VfL6S7zUlk4/OF4pzxk9QFfUWj8UXEtoA2urb98DggGMHyrbSJ tYx8bVcyW++TZ5Lun+WzTJYCNsBHN2kpbw9ymxWL/8mDBS/sv/yruSStqQLoZDepQQ3j zG3w== 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=QRRSRzv3ELZyPDBdtIE45poUqjMQaq7ox4Jm7P7/zG8=; b=0dYSoKOj/y6BbVIvSHAIVcUXwdhoaiygyZEtjJ1CV5rVAqco3zHW3nhJSDTEIyOtLB sgLcB9YmXpeXREweUxyenlF9+huUYU/a2ySJSvYUm58FCQOo+1qGnuxEW4wvo6PviMW+ Ato11/gHLLUXcaNT2//NUwrXi9uxYWWnfab5O6QU7Na1OhBmE4qyK10op1bsb8Edql9E 4Xpt0uh9DHdRjjzRL3VTNIHjdP7DGmDbPl4FL1O1Z+P4NJ29WmnrX6GDJM7c2nhUCSiv AGhThD2JziAZCBvUEDYwz8dOtcmTbdhRBBb+hvuBppFCWPcQUmm9CfYc9YRQqe+Aj7Jg J3gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R1yAor3A; 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 h21si1480135edj.79.2020.04.23.09.07.42; Thu, 23 Apr 2020 09:08:11 -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=R1yAor3A; 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 S1729589AbgDWQEB (ORCPT + 99 others); Thu, 23 Apr 2020 12:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729257AbgDWQEB (ORCPT ); Thu, 23 Apr 2020 12:04:01 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34F8AC09B040; Thu, 23 Apr 2020 09:04:01 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id x15so3180130pfa.1; Thu, 23 Apr 2020 09:04:01 -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=QRRSRzv3ELZyPDBdtIE45poUqjMQaq7ox4Jm7P7/zG8=; b=R1yAor3At9e+xtBhUr6dlgl7zNXUVenScXyHMgcn6IEG2US+/UvODrE8lbtPt/gLs/ fbWEVj/JWvpO34kH3WTmFqm02fkOHuQ7PhIiONd8EUu3SW3XtYCNPbk92Xa4fdfbrRE1 PXQd0r0F2W4Fp10i4ld1cmfne4gSHWf8NyMjtGLwvuq4GJmQJABiDyvshdytsc4Dk0Rx e//SCLAP6/rdoNEqY0IdCqIT3FibTx1vI72kTE3eLnhpUYI2ZreFg08S9YtkGEs0zhOt WX9FXySSlDXshp0yLq17w2rYTW0o1mmx/y55DH11xOJlY8NmfYyv7tfqjERP5kVDnBrD Eccw== 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=QRRSRzv3ELZyPDBdtIE45poUqjMQaq7ox4Jm7P7/zG8=; b=TVIeVzzejAOOiRRSoz4/GvNBmr5n75ABs+uF/NIo/cF4b3z+CngP+2xcfu0HXoPN4O gw3GWY1e5GxoaCfNEHMIxVlcDrZuNx464YMIY6HTgDL3jT8r55Mgq1IYOujjzo3zXf5X iMgry4kzJyhwxE03G5YmSpIVIT2XtMuA8aakiZ7/YpNUUtbo+FPTbL7le01odsE39v4S mVYyiSMapgsvQvAUZyvrhDTbiKgPrGTM/YvyByT9Ao8+bqywZX/jMhKXTO3kUPmRFpC9 cfh+vKW4gKHw/kxpPhCxagCPzHKg7I7BIzM48OUR0KiTAjH4J6Ub7syT1sBfGHKjyo0w fSLQ== X-Gm-Message-State: AGi0Pua+3BR7Q1XoCz2myIeaDcqmDzHUuyfJn6MeyNrAbwM+d1lB3mJM A0NH/FWcDNXqArm9nKELxg0= X-Received: by 2002:aa7:82d4:: with SMTP id f20mr4501737pfn.253.1587657840767; Thu, 23 Apr 2020 09:04:00 -0700 (PDT) Received: from localhost (176.122.158.71.16clouds.com. [176.122.158.71]) by smtp.gmail.com with ESMTPSA id a200sm2867954pfa.201.2020.04.23.09.03.59 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 09:04:00 -0700 (PDT) Date: Fri, 24 Apr 2020 00:03:56 +0800 From: Dejin Zheng To: Andy Shevchenko Cc: Greg Kroah-Hartman , Thomas Gleixner , FlorianSchandinat@gmx.de, Bartlomiej Zolnierkiewicz , Ralf Baechle , Thomas Bogendoerfer , dri-devel , linux-fbdev@vger.kernel.org, Linux Kernel Mailing List Subject: Re: [PATCH v2] console: console: Complete exception handling in newport_probe() Message-ID: <20200423160356.GA2538@nuc8i5> References: <20200423142627.1820-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 Thu, Apr 23, 2020 at 05:52:09PM +0300, Andy Shevchenko wrote: > On Thu, Apr 23, 2020 at 5:26 PM Dejin Zheng wrote: > > > > A call of the function do_take_over_console() can fail here. > > The corresponding system resources were not released then. > > Thus add a call of the function iounmap() together with the check > > of a failure predicate. > > ... > > > CC: Andy Shevchenko > > Use Cc: Better to read. > I will pay attention to the next submission, thanks. > ... > > > v1 -> v2: > > - modify the commit comments by Markus'suggestion. > > What suggestion? You need to be clear in changelog what exactly has > been done without looking to any previous mail. > The commit comments have some more appropriate instructions by Markus'suggestion. here is my first version commit comments: if do_take_over_console() return an error in the newport_probe(), due to the io virtual address is not released, it will cause a leak. Thnaks! > ... > > > console_lock(); > > err = do_take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); > > console_unlock(); > > + > > + if (err) > > + iounmap((void *)npregs); > > return err; > > } > > I have briefly looked at the code (it is actually quite old one!), and > I think this is half-baked solution, besides the fact of missed > __iomem annotation and useless explicit casting. > The proper one seems to switch to memremap() and do memunmap() here. > > -- > With Best Regards, > Andy Shevchenko