From patchwork Tue Jun 12 03:15:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhouyang Jia X-Patchwork-Id: 928045 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SetC7ehj"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oU5i1jzH"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 414Zl82qJkz9rxs for ; Tue, 12 Jun 2018 13:15:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=FHsn4AyetkxWXIIGs6KTYcaQCm/YSli5792VmTwo8UA=; b=Set C7ehjtrpGE0d33T3j6nxvDzBtqskdc6z2PNkW4Oqijw8KBx/FQE5bx5lb27pliGvQrPNppuHyFMNh j7X/gQYClgquVypWgUhFoRWPsCdcoc1R+IWqC2XlFxQeCWuG9gNKwXUppYvnCtUN1SFZ0AmSXoxLe I5UkVMlj0jc5XOxYAt5LHmIQ1mucYQy9Jav4mL+FrgmHDHNsheXkrxKOJFKv3g6LYL+/nk9EGnJll wcJdJ/1d1ETL9WnvXiMMfVRg1Sv75vbcDKQkDaNYjV3afRjPXuzzvBupfp0mhVQ5LacG3ENkOw2We Am+5EJcozw/2ooNmADaVjoru4K2dzPg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSZmG-0006X5-8T; Tue, 12 Jun 2018 03:15:24 +0000 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fSZmC-0005Ur-Gx for linux-mtd@lists.infradead.org; Tue, 12 Jun 2018 03:15:22 +0000 Received: by mail-pl0-x241.google.com with SMTP id a7-v6so11019200plp.3 for ; Mon, 11 Jun 2018 20:15:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=GG3zVFMiu3Jz0YuRpJSyBvqtBSRol/XgVgxuDZDIlY8=; b=oU5i1jzHL17nepEXmHNAERYR0oLYrH0dsJ/oHftd7N4IZV5RocuTLTofOmybdGGDa0 KzjLrWqV89uk8WFYyXjXeK7sZErchDox2iYO2SNgwTR9Bd/FxPutft5Q8C0sPbDJVjL2 0HnqYwhWyF3Jgix9pUsraZ5cKrC9EtDmW/vTIp003NUkPYMmZNJ0k+zOp18wIC/qE3/g 7VC3kogv9s78yrweuXXLSBaaOLowf8CHVT6noqwzWkDOoj0A0VQSAPUZRz1Oq/q3sJyb S4F6CRJZjItAc4E7M7bfnAHRnq1j3ZBVIbemsW74d470ZhsNmmeuKsZKHn/k4/hZt1J0 DiWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=GG3zVFMiu3Jz0YuRpJSyBvqtBSRol/XgVgxuDZDIlY8=; b=IljibGvjiUSSRaPCOvB8fRbxBwxRTHTxozwpP6VAkEaWjee7vRc8SvqgJO0RMndCIM Q4a0TQIiwV8382efxmXXnvOsaWxe2mPmLOcB4qaFFWdKDJIbKN9zCY1SEB9ZyGfvQbkV kqc0EvjNAT7O8f/JD1e7pRWXd3W88g9RngHlC6w300iiWF/KqJzc/ifHmGGYoNOSfDb7 cp2d2ZQv+j8SdeJiPbQCKN1mJVw1LhluvHcjw/qX7FOpHiaK/xhKFnqc2ysQ5vGufU3H qyBMM185d7HbB1Fwvag/i/xEPNNCLcWDU/iFsqp10T+WKTa3DTDPspfppcAiw51peqmZ TVxw== X-Gm-Message-State: APt69E2oCQwQc+Kf0QE9q5rtjSJ4A14fK0tCteojOIt4fcJ/isedLWG5 rtuiBx5GL234VwYS9Y1syxI= X-Google-Smtp-Source: ADUXVKL+hm47R+f/41iakVvKDeSkP1hWjVolfgzsaKSsp+aip29HhI4d0YS/zE145xxdvaOvltzByg== X-Received: by 2002:a17:902:570f:: with SMTP id k15-v6mr1963870pli.17.1528773308483; Mon, 11 Jun 2018 20:15:08 -0700 (PDT) Received: from localhost ([103.88.46.82]) by smtp.gmail.com with ESMTPSA id h124-v6sm30706446pfc.100.2018.06.11.20.15.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jun 2018 20:15:08 -0700 (PDT) From: Zhouyang Jia To: Subject: [PATCH] mtd: gpio_flash: add error handling for ioremap_nocache Date: Tue, 12 Jun 2018 11:15:00 +0800 Message-Id: <1528773302-37265-1-git-send-email-jiazhouyang09@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180611_201520_647565_C4BA07F5 X-CRM114-Status: GOOD ( 13.60 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c01:0:0:0:241 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (jiazhouyang09[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (jiazhouyang09[at]gmail.com) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhouyang Jia , Boris Brezillon , Richard Weinberger , linux-kernel@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- 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..7fbba02 100644 --- a/drivers/mtd/maps/gpio-addr-flash.c +++ b/drivers/mtd/maps/gpio-addr-flash.c @@ -242,6 +242,9 @@ static int gpio_flash_probe(struct platform_device *pdev) state->map.phys = NO_XIP; state->map.map_priv_1 = (unsigned long)state; + if (!state->map.virt) + return -ENOMEM; + platform_set_drvdata(pdev, state); i = 0;