Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1949298ybz; Thu, 23 Apr 2020 08:54:30 -0700 (PDT) X-Google-Smtp-Source: APiQypKexXCL+V9tlr9SAPQI+oD5FT776lcqL69qYM2UgVHkCubz124UA9C/pBhO56PRwGE1mrW2 X-Received: by 2002:aa7:dcc3:: with SMTP id w3mr3065603edu.231.1587657269831; Thu, 23 Apr 2020 08:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587657269; cv=none; d=google.com; s=arc-20160816; b=EDwLfYQ4GooA7KHjTbpketAaBkd5BNkgFmAKm250cTRxfzSZR+XEveZ7oUAA530igb HR26rSIb9YnzfMmgc29JCsfZOFdZ9tXoKtjiVtbdZHpWQsD5kh8pdPax3BtsvMftGbsP CKHqyPBhxS7NJa2GW6CGGflCOk/Smz0Mtv+2DfkLOgkQA/yvoFi0nBYdjEKFMaWKehBt Vs6+denO3Oc+3V8iFkNspfd5i5SF56j28SFeU5Zd/GDMe/yYuu/qnKqniXVz7Ax7rcs1 jk59Yo1DT+GeO+3WawAhPYKnOoup5Txb8XRQPIBD6S8HMonMCLoqL3ZWm6gel7lZ/kLN l87g== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=+Lpx84ybnP3CbGO9+hIlMb8pKZvpHlBUCvuaUaL2gSc=; b=tWRe8JzDaPT6rJCSlc99rqqibtSOwQYOpZAysOgY6sg3SS1TuddE9xJhH0sxpCxqE+ +oZ5KkoP0pZkKTjPWhQtEy36qdHL2o7ySfvh7VKeyi3XzQ+X9F3LWKrHoT0conmnipXq Hyu3xX1JP9Fl8I03zLnWOdUsuKPTSdUXSNErOTI/VXTjiinjGTkEhWJ2veKbwPMEomoD +hYxgm4WP/S8vXUu2jQ5pU7UWPKukj5sPvTh/od9O1I1+7KbrP06CDCV5x0ASphIr+Bi RHu6a0eFUwaAk16K0FBQ2a6zgvMhH5xXwwRo7n3R9aJnCWMDyZLi3aRQVbYg5U93MqQT nS5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=siyn8fn9; 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 z9si1468064ejg.296.2020.04.23.08.54.05; Thu, 23 Apr 2020 08:54:29 -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=siyn8fn9; 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 S1729410AbgDWPv0 (ORCPT + 99 others); Thu, 23 Apr 2020 11:51:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729072AbgDWPv0 (ORCPT ); Thu, 23 Apr 2020 11:51:26 -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 B8770C09B040; Thu, 23 Apr 2020 08:51:24 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id 18so3144166pfx.6; Thu, 23 Apr 2020 08:51:24 -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:content-transfer-encoding:in-reply-to :user-agent; bh=+Lpx84ybnP3CbGO9+hIlMb8pKZvpHlBUCvuaUaL2gSc=; b=siyn8fn9dgNTeY0PFfNmf3LQOi0S4q18gLuG/8tqxoJ2xhYIUJtylgFoSPsgXvC62U 13PR7A6ZHoCHxk6J5LGWsHxwmqAbc9fAL3QpZTmQHXf9lND8mWx5WZsepUSTtHf9ilO7 iYoWUINohBd88hEZk/vniNzaVSpxQQlBxTzTUaUQwdFnNk1BX0IqjmE0DXZjEPE+BFO4 o+TOxBANszxYwZg9ETuztp4Z1kS2iy8RSSXxvZKe5QHPZYDg2RfNblXS9svfX0sneC3Q Ap0U76J8jIoXqnEHpcJQWa7SFgJBTPm73RPp2csNvjdfbyUffI3AeCGPC6DWelbU6sFA eVVQ== 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:content-transfer-encoding :in-reply-to:user-agent; bh=+Lpx84ybnP3CbGO9+hIlMb8pKZvpHlBUCvuaUaL2gSc=; b=Vw46uONZ2rbslhgTGFzcq7IbllIpLNb7skz35flTY6ZLxyxZE4Ra4+Hk2VXgTSHCft o7UqxtA/OuCBzfm+Mkmw2/OgGfUTxLiZKhMSxhIexyr3yTbUqOT5NB9RZMSiOaQ1C+6O I+NwCzEh34kDgREtBP6bH5X8oQrPlm1jsmq7P+TmJnLbXyLxXcsPsuOqZnXZ1ixStHoR wX5U9237YCBqmj/cZd9XVue6SXensU0qKmkFUO+z8YwreWyQnxBEvODexIjNwBSRZOaN qQLwKuJAnlTQQa/wpM3d347IlcSog7G0ncodvrhGuFxgorQswLqmpXoExe5wrOJB44wi 7bqQ== X-Gm-Message-State: AGi0PuYnSYht+stXoV2Po6iCcRoMj5tnmf6HCl+0HxjOmA19nLvHLiGd phBkcn4U4fiYv4tk6g6deQY= X-Received: by 2002:a05:6a00:d:: with SMTP id h13mr4466425pfk.254.1587657084207; Thu, 23 Apr 2020 08:51:24 -0700 (PDT) Received: from localhost (176.122.158.71.16clouds.com. [176.122.158.71]) by smtp.gmail.com with ESMTPSA id h17sm2931338pfk.13.2020.04.23.08.51.22 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Apr 2020 08:51:23 -0700 (PDT) Date: Thu, 23 Apr 2020 23:51:16 +0800 From: Dejin Zheng To: Bartlomiej Zolnierkiewicz Cc: gregkh@linuxfoundation.org, tglx@linutronix.de, FlorianSchandinat@gmx.de, ralf@linux-mips.org, tsbogend@alpha.franken.de, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: Re: [PATCH v2] console: console: Complete exception handling in newport_probe() Message-ID: <20200423155116.GA2247@nuc8i5> References: <20200423142627.1820-1-zhengdejin5@gmail.com> <081f8192-1708-80ff-6eef-885d72bdf5c5@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <081f8192-1708-80ff-6eef-885d72bdf5c5@samsung.com> 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 04:55:35PM +0200, Bartlomiej Zolnierkiewicz wrote: > > Hi, > > I believe that the patch summary line should be: > > "[PATCH v2] console: newport_con: ..." > OK, thanks! > On 4/23/20 4: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. > > > > Fixes: e84de0c6190503 ("MIPS: GIO bus support for SGI IP22/28") > > I cannot see how this patch fixes commit e84de0c6190503 > (AFAICS npregs has also been leaked on error before)? > yes, you are right, the commit should be e86bb8acc0fdca82d2 ("[PATCH] VT binding: Make newport_con support binding") - move register ioremap from newport_startup() to newport_console_init() > > CC: Andy Shevchenko > > Signed-off-by: Dejin Zheng > > --- > > v1 -> v2: > > - modify the commit comments by Markus'suggestion. > > > > drivers/video/console/newport_con.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/newport_con.c > > index 00dddf6e08b0..6bfc8e3ffd4a 100644 > > --- a/drivers/video/console/newport_con.c > > +++ b/drivers/video/console/newport_con.c > > @@ -720,6 +720,9 @@ static int newport_probe(struct gio_device *dev, > > console_lock(); > > err = do_take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); > > console_unlock(); > > + > > + if (err) > > + iounmap((void *)npregs); > > Looks OK but while you are at it, could you please also add missing > release_mem_region() on error and on device removal: > Ok, Thanks, I will send the patch v3 for it. > newport_addr = dev->resource.start + 0xF0000; > if (!request_mem_region(newport_addr, 0x10000, "Newport")) > return -ENODEV; > > npregs = (struct newport_regs *)/* ioremap cannot fail */ > ioremap(newport_addr, sizeof(struct newport_regs)); > console_lock(); > err = do_take_over_console(&newport_con, 0, MAX_NR_CONSOLES - 1, 1); > console_unlock(); > return err; > } > > static void newport_remove(struct gio_device *dev) > { > give_up_console(&newport_con); > iounmap((void *)npregs); > } > > ? > > > return err; > > } > > > > Best regards, > -- > Bartlomiej Zolnierkiewicz > Samsung R&D Institute Poland > Samsung Electronics