Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp540693imm; Sat, 7 Jul 2018 03:00:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeSdKu/emgkrBzYMoIVUQwWM/qSyhlnu/vWINQ8s+9xieiIe6Vs/CC9LW3aACbza45R+Prd X-Received: by 2002:a62:858c:: with SMTP id m12-v6mr13777421pfk.173.1530957648749; Sat, 07 Jul 2018 03:00:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530957648; cv=none; d=google.com; s=arc-20160816; b=uPxtJTFo6gMMiZUsLs/Q6TtfIdfwJVaV859RRQmPPx/PSdxS5mZp01hsrgHSxxlFiW qljGPyetJVxlamkcwD0GTxXQM4csUF5fAGfLwE8ctmcyhgxVMc83aVIEdt9gYV7NbwIb +qMiMKNkomViIv9cSj9IJuQhKC5nXCltVj8wV6XhGrlvcuvJrWNpGsaMu/kOXnt5hfH3 1pgORQJzXxbOyY1IQ3fPpxvDbPELYfdIOLBkRRK/7kp6o3dQ1zNgRWF6IoZ3V2kA/dHC l+V6Jp4OGtv1W22zd/JH/m2eE6MKLQDI4s08vsUrL8btx1uyCdYhws+DnvRaNpYzKgat PL3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=1Fl/7lU1cVANKsdKrtubuIflsg34D5EhlqxFpgEbDyU=; b=DLKPTlppRPulMZaPZdoUU4DxKREjgGMTuqLPnW/9UQlsfWYDFOf/8QKOCJF0W8OR+p mEhpEtrpf+lg+iGDevnPUCiW8oy3jdD0RMZLHvFBhapT6gD6/+u6xk8arpwIZkn1MSAo oM1lz33Br1t3O+AUVkE5/qx57vLK4CSeVXiog0vzz7eTKNvBWyFh1SMaZvJ61LOro9N8 KTyO/ia48heHCqz/WepxSEUD9yMNuy71YtfEds4S2q9Fuc5r8ETOnqfcwXhHSCvcdBN3 jZ4Peens1bZU/lwx8IceonpPivvr1efN5LwvWZzIlGRI8rokGbynPnDVu4Tm5YiCExT1 kGJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q185-v6si9919142pga.322.2018.07.07.03.00.21; Sat, 07 Jul 2018 03:00:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752861AbeGGJ7T (ORCPT + 99 others); Sat, 7 Jul 2018 05:59:19 -0400 Received: from mail.bootlin.com ([62.4.15.54]:51617 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751693AbeGGJ7S (ORCPT ); Sat, 7 Jul 2018 05:59:18 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id A626F207AB; Sat, 7 Jul 2018 11:59:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 6767820741; Sat, 7 Jul 2018 11:59:15 +0200 (CEST) Date: Sat, 7 Jul 2018 11:59:16 +0200 From: Boris Brezillon To: Zhouyang Jia Cc: David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mtd: gpio_flash: add error handling for ioremap_nocache Message-ID: <20180707115916.1bbe954c@bbrezillon> In-Reply-To: <1529632343-70907-1-git-send-email-jiazhouyang09@gmail.com> References: <1528773302-37265-1-git-send-email-jiazhouyang09@gmail.com> <1529632343-70907-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 22 Jun 2018 09:52:20 +0800 Zhouyang Jia wrote: > When ioremap_nocache fails, the lack of error-handling code may > cause unexpected results. > > This patch adds error-handling code after calling ioremap_nocache. > > Signed-off-by: Zhouyang Jia Applied. Thanks, Boris > --- > v1->v2: > - Move the test just after the ioremap_nocache() call. > --- > drivers/mtd/maps/gpio-addr-flash.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c > index 385305e..9d97236 100644 > --- a/drivers/mtd/maps/gpio-addr-flash.c > +++ b/drivers/mtd/maps/gpio-addr-flash.c > @@ -239,6 +239,9 @@ static int gpio_flash_probe(struct platform_device *pdev) > state->map.bankwidth = pdata->width; > state->map.size = state->win_size * (1 << state->gpio_count); > state->map.virt = ioremap_nocache(memory->start, state->map.size); > + if (!state->map.virt) > + return -ENOMEM; > + > state->map.phys = NO_XIP; > state->map.map_priv_1 = (unsigned long)state; >