Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4814894imm; Mon, 11 Jun 2018 20:16:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLbPuEpuEIpfShx08ilKgSD7glkw4Pkk3Ud3+GiXqDzKc5Q1hARwwptrALCr9mROqZMAADD X-Received: by 2002:a62:8b0a:: with SMTP id j10-v6mr1905787pfe.28.1528773363255; Mon, 11 Jun 2018 20:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528773363; cv=none; d=google.com; s=arc-20160816; b=bz+aA+jZg1nhCE69PbHto+fYDL8xNjCxp23wCQR+HhE4wR6j8SdBzOyc3QYEIRc6zo 4AQmbpgWv44w3AYeqDbX0w5PJc/3ghRHMOAqmaKwGzGcbZap2FhWLDx6X4Z7nFXjUgGb rEy2UmLX6zAjag4PnPQzqZ3YwdAJ4bdMhu3DUTPBAWfOhLPj6skLL0LXoIkDIn7FdyX6 3StS1Tu+ZbvIbegJnNVqLt8TJqyxkHxHjHniuPOeLiyMvjuXRF3tSvqsPwAIDkXcPaCe 9qxaAdvZhA0bYs1hliy88SXOKio9bp2KYbNzIJmgGCjAwRnzeHkcdC7rsKvqk5YTT26E +5Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature:arc-authentication-results; bh=GG3zVFMiu3Jz0YuRpJSyBvqtBSRol/XgVgxuDZDIlY8=; b=aLB6uI43gq/qzbo8IykYDPz+F0/OlhxQ7rJoUR1OXg0LP1qmdrtRHjpPoO34LRPHTW xBBLPlD9o8AHKzJaymr4JKFQKHA81sfNO6d6ppTCVZ1RQCs86FuRSwOHT1j3C3AIGN0S VG4GMrZl8Lr1O5HX8ncmziqDebNyL5Uj3KBbo4B+W7v0qSN7L0Q4LQ+BXAlKOJD6ta2v gGc9n9gf2+DnVqpn1akxTx9i/YwNwYrR1jirgVsm5P7NJVPKK6kKb2PUOy63ALG9eGcM UpFDX22yNcYv2/FDk3NvVSw+CHbvP2/D8pf6aKHa+i2SSpCdBDgOV/VNXTHlmZga/iUz M7gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=oU5i1jzH; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w23-v6si22822632ply.320.2018.06.11.20.15.49; Mon, 11 Jun 2018 20:16:03 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=oU5i1jzH; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935247AbeFLDPK (ORCPT + 99 others); Mon, 11 Jun 2018 23:15:10 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:39744 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934958AbeFLDPI (ORCPT ); Mon, 11 Jun 2018 23:15:08 -0400 Received: by mail-pl0-f65.google.com with SMTP id f1-v6so13517686plt.6 for ; Mon, 11 Jun 2018 20:15:08 -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=rRacdWmOTOwmBUOZ8E/toTzqotUFjE8IfpG2D3NpQWSGKmZQS0Ean8pP9YiF5YbLAT yuPLQzidFEnAckZrW3eWXmd/V9uK2u3zKJhQotn5Ak9lwL4SPlm+eJQyLpr5/lGXyctK 8cLE0vpFw4evcSfbrVK3LAyKh5WAvCSCMsjjoJ4HocpFjeJXkUX7FvYAnUlx1iC1JAVB b1nJRWAGQt5WWLl6BmAIpGN0FMEaABUloBXJ6kDoMciLEolnEwiZti6aVY5+HcbUsLwN AMi/nhJ+0uSkJjlhyyJ7IGdkzmkK/XnhqjXdQDCwkA1RP688mfnZHRkPymOi6gOGDR1B 4h5w== X-Gm-Message-State: APt69E1klYLhgvjoUD7G53IyQOXJcuq4Xi40HIomokzgPI4K+D0tInQG a88+mpDo7T9GBL13SgLFzhU= 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 Cc: Zhouyang Jia , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org 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 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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; -- 2.7.4