Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2145332ybz; Thu, 23 Apr 2020 12:23:35 -0700 (PDT) X-Google-Smtp-Source: APiQypINoUkHiori2svw3CZ5KRZ7MceDBCpyab5nP520YhxtGDFt1WDfgbH/ivu3gkdoBLulmHQ2 X-Received: by 2002:a17:906:4f8b:: with SMTP id o11mr4175082eju.268.1587669815498; Thu, 23 Apr 2020 12:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587669815; cv=none; d=google.com; s=arc-20160816; b=wmtHTCWrAU5kC8FZzbAP6Ah0qAWF6oyCAWLBGOO1QDNA+1jWp7beRvazHLwPZXw9+4 mXG/awANob8zQ24TuZNuWEvDjXL70gul1r2efK5rGDdKntNDBatLKen81j0yDjJbXL22 PA3ceSjbM1q9g9LsEs/zq48IsDP+tw4gLtzAvJEW5fNX+u7qjxlFviE6KpbrdKfZqPgx 62RpcFN1fwK/NHdfcSTz/WWdLPXPjNIAZWV+Vdgu41h0Z1KYpNShf8U1fIqQ5qV7D4uK UsOX8swgrIU4OEAGS37NbGEIH2PTccsjCShfurU2vmv9w5qCkAN2DyZyNCDizAFUWW6U eFyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter; bh=4jBedYbVs9iPISb4SHRfEbPFJqP00QurHGBQmIMMH9o=; b=pnugIDukvTlUls1A25kfZrfz7NDTR7x9big1uG4Lr+UXq18OWZpU+Aj8cYWDP8nyZz fi0Ac/YXoTBQLbdtE5mmjP66QFGLU/1jBvEzh5VoFizEi69jONdNOoOppb3viZQIx2tc OdsG5FTNXmppA94qjEEYVE0aM0ZXNUm+EwPotBDbbKZITizcfFJzHG77b75y8XFyQ3q3 MGxF5wsuV+B+AT/hOAumYdO2/SUVj0wvG5bdk5Roq7UM0p1XdRtSgKNpItdKnPe0xY7G opeYgHKSUxnnXFGs1FAgQTzTtoSQ7pkc5ONtMzT8HYcmSLhfkPZLytus50AMGBGx4MxL MWpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=KmXYnhcF; 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=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si1737400ejh.233.2020.04.23.12.23.12; Thu, 23 Apr 2020 12:23:35 -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=@samsung.com header.s=mail20170921 header.b=KmXYnhcF; 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=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728916AbgDWOzi (ORCPT + 99 others); Thu, 23 Apr 2020 10:55:38 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:40548 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728816AbgDWOzi (ORCPT ); Thu, 23 Apr 2020 10:55:38 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200423145536euoutp01bd96fd2b6c82695c57682e7aaad581c6~Ieqlve2kb2813928139euoutp01c for ; Thu, 23 Apr 2020 14:55:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200423145536euoutp01bd96fd2b6c82695c57682e7aaad581c6~Ieqlve2kb2813928139euoutp01c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1587653736; bh=4jBedYbVs9iPISb4SHRfEbPFJqP00QurHGBQmIMMH9o=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=KmXYnhcFiNWsqafuebllh6+baVzXgyJ35Y/K6QD6Tr++BrpHYhXI/OhzxCArk9+kT awrP/Wa4vz3+aJSzNTLu1EyVF/chzn0/E1cpk6K3JawP18fEosiwmFRyNcRTD4GgY0 x8ANFqiUqjb/bkrr0fv5bwfosG9SGDYL1CID2ckY= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200423145536eucas1p11d03e6479cd7a4ae7276a37b6d2c144f~IeqlZ1cJj3041030410eucas1p1Q; Thu, 23 Apr 2020 14:55:36 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 3E.4A.60698.86CA1AE5; Thu, 23 Apr 2020 15:55:36 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200423145536eucas1p1d17d340c8ac30b9e186bfaeaf593f1b4~IeqlFFyEW3041030410eucas1p1N; Thu, 23 Apr 2020 14:55:36 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200423145536eusmtrp14eaca221daa39987e6c63814679c691d~IeqlEWxNm1059810598eusmtrp1I; Thu, 23 Apr 2020 14:55:36 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-85-5ea1ac689cbc Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A3.6B.08375.76CA1AE5; Thu, 23 Apr 2020 15:55:35 +0100 (BST) Received: from [106.120.51.71] (unknown [106.120.51.71]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200423145535eusmtip16a9e68a9b4493120f55398ce1a99fd94~Ieqkkhsqz1968119681eusmtip1u; Thu, 23 Apr 2020 14:55:35 +0000 (GMT) Subject: Re: [PATCH v2] console: console: Complete exception handling in newport_probe() To: Dejin Zheng 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 From: Bartlomiej Zolnierkiewicz Message-ID: <081f8192-1708-80ff-6eef-885d72bdf5c5@samsung.com> Date: Thu, 23 Apr 2020 16:55:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20200423142627.1820-1-zhengdejin5@gmail.com> Content-Language: en-US Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOKsWRmVeSWpSXmKPExsWy7djPc7oZaxbGGTRPErV4OeEwo8WVr+/Z LDpnXmO0aF68ns3iRN8HVovLu+awWVzao2KxedNUZovDTQeZLXY9usnswOXRemk5i8fOWXfZ PT58jPN4d+4cu8fRlWuZPPbPXcPucb/7OJPH501yARxRXDYpqTmZZalF+nYJXBlnFjSxFTQK VEy99pq5gbGPt4uRg0NCwERi8Ra2LkYuDiGBFYwSbQcaGSGcL4wSy68fZ4dwPjNKLN03AaiM E6yj59cKqJbljBKXP0xhhnDeMkoc7H7GCDJXWCBK4uMxTpAGEQF1iZkt/SwgNcwC3UwSr083 gE1iE7CSmNi+ihHE5hWwk1j8tpkJxGYRUJX4tvEDC4gtKhAh8enBYVaIGkGJkzOfgMU5gXr/ 7D8FFmcWEJe49WQ+E4QtL9G8dTbYQRIC99glln87ygRxtovEkxNN7BC2sMSr41ugbBmJ05N7 WCAa1jFK/O14AdW9HRgCk/9BPW0tcefcL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lbmHGCU4mJVEeDc8nBcnxJuSWFmVWpQfX1Sak1p8 iNEU6LmJzFKiyfnARJJXEm9oamhuYWlobmxubGahJM7bIXAwRkggPbEkNTs1tSC1CKaPiYNT qoGRu+BVlJ+tQ/LDI+8rHiyw1og5U3blvpRH++lI7YD7DeFm/Rs2+k2rWnvS/zxHD3Or/GNu 62MVJSvmpR7ZvLml1fX0r5yG6fMmec2e6y5zRSeXkY/9o7XhSb2VLCxfnVjn9S048Hjr75yT G/w3BxzWYOdaEP5vXt4T/ov3DhebH275kxLPI/JeiaU4I9FQi7moOBEAYiueT+wCAAA= X-CMS-MailID: 20200423145536eucas1p1d17d340c8ac30b9e186bfaeaf593f1b4 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200423142637eucas1p2ea543e281d96c75aa4292b49756f2146 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200423142637eucas1p2ea543e281d96c75aa4292b49756f2146 References: <20200423142627.1820-1-zhengdejin5@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I believe that the patch summary line should be: "[PATCH v2] console: newport_con: ..." 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)? > 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: 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