From patchwork Thu Apr 26 15:41:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Lefebvre X-Patchwork-Id: 905158 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=none (p=none dis=none) header.from=essensium.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="J/8mWV2Z"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=essensium-com.20150623.gappssmtp.com header.i=@essensium-com.20150623.gappssmtp.com header.b="ObMMduU7"; 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 40X1b83DKSz9s08 for ; Fri, 27 Apr 2018 01:44:36 +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:References: In-Reply-To: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:List-Owner; bh=eB/mGj/iAAh6bgveL6oy053ejxqxrpyMgDFYCCxGkUo=; b=J/8mWV2ZGKWS3nvgLrPCVwrJvN HYBLecOwQypN+8q2QP4nPL8OZ52g+N7+LydOwtAc182dCqcirKRNJAtYtWy121JKqKCtkM2wc4C9o II6Bo5kM+eioq5CGI6lLozCm0d1KIOxj7dIYZtOUKQXmCT0ketKl/Z6t6BLO0AT2/nH4/S0WdQ0RX H4bAQo2RIaGS2VAYPzC3omLNTgNaIAv0lebLBXewlbDKy16qMbwDIQTVRjSN+YU6FbMUYYu5zTLZD qjeyVtUWCsd3N9fQengyqBMsBibCb7B4tmGuqesDIYynV/eTNc3BpnLDWXJ6oMP7vDYRBRadv1moj iFBCpxYQ==; 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 1fBj4L-0006ce-RK; Thu, 26 Apr 2018 15:44:25 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBj29-0005i9-Oy for linux-mtd@lists.infradead.org; Thu, 26 Apr 2018 15:42:12 +0000 Received: by mail-wr0-x244.google.com with SMTP id p5-v6so29489502wre.12 for ; Thu, 26 Apr 2018 08:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=essensium-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=egUyTf5dWRr7WjHzowLsMJlRypf02ouGtOE5D7/9M6o=; b=ObMMduU711NaqAheLEWNBKqBdQUGnUYUFUiHwJk8K7wSLGBl4l65hdV9EBQYtxJCDQ ckDRItewoSS7jZ3Nt9BlCFy8mBugIfq8jlO0cULT+ozAk8/VwtNwtSVkMraYVXcK0ios aNmyx0S+U39PMAVPfNtoPvfkqZhrpaxvKp6nSAsv+0kTdXMQBZiEZiOvbYDDgxPeDgwg ShUo5/+mJsn7EEXUqnMZQmNNxYhy13qYTWQxvgbJYDZaUyQ25CNFI1MfpdRKc05/qYcZ kvtUA7ADFawmz+Ali+aAbJ/RT0pSYUhrEttyNKNtG8w8SICtNH589CjRD7Igw3nJuirb SmzQ== 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:in-reply-to :references; bh=egUyTf5dWRr7WjHzowLsMJlRypf02ouGtOE5D7/9M6o=; b=KnHLSuV5+vlqeWPpKdbhlvBf9QxO1b30UAOCf7khGjD2sNYxlsmZJA0y4UPheqENs9 YRVhSD9Q0xzGDjO9pc/EnZAaJKtBlrIiND7yjzrXn9dewCMjHhOSeEsKF93vfwERSEpE vISs16oBZURsJyENc7S6lvysRkvB0FtAkYNrqONbl8z0fz+Vk931GzeVGLWjfrZpRW5z XCJUxTVVOpgA6adTkB3L95/f7q1ml1PI/08oSv0TIFtLbL2yHDBHcSSLbKnOShlMCRVY EbnjCKpMF/ucw3kr7qRBRuX4/rOS6h5XGxTAiPlZGUrwm9Rh9aYPQLwmmxeDxC3ZkYhm Yjcw== X-Gm-Message-State: ALQs6tBS7klAEfLRGIOGDgN5rzcTPM6CCYBfmcnogO9INndj7WlMQMsm 0/mTz69rCVyE5Cg2esBKdKPIc2Z1 X-Google-Smtp-Source: AB8JxZpRNZv3Z3eVkfaqoBYCpqi9qxu1uIA0t+Cze/qZ+kAfIwD80k3WS1AMJ8j6BxtWZC6AxOEwIA== X-Received: by 2002:adf:a3d7:: with SMTP id m23-v6mr10503350wrb.209.1524757326056; Thu, 26 Apr 2018 08:42:06 -0700 (PDT) Received: from Darth.local.ess-mail.com (178-118-196-9.access.telenet.be. [178.118.196.9]) by smtp.gmail.com with ESMTPSA id n23-v6sm19916031wra.39.2018.04.26.08.42.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 08:42:05 -0700 (PDT) From: Sam Lefebvre To: linux-mtd@lists.infradead.org Subject: [PATCH 08/13] mtd: rawnand: gpmi: return generated errors in gpmi_ecc_read_oob() Date: Thu, 26 Apr 2018 17:41:29 +0200 Message-Id: <20180426154134.8270-9-sam.lefebvre@essensium.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180426154134.8270-1-sam.lefebvre@essensium.com> References: <20180426154134.8270-1-sam.lefebvre@essensium.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180426_084209_859426_FDFBB9DB X-CRM114-Status: GOOD ( 14.51 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c0c:0:0:0:244 listed in] [list.dnswl.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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.0 T_DKIMWL_WL_MED DKIMwl.org - Whitelisted Medium sender 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: Arnout Vandecapelle , Sam Lefebvre , Dries Staelens MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Errors can be generated by nand_read_page_op(). It's important to check the error flags and pass them upwards. Signed-off-by: Sam Lefebvre --- v2: also bail out before calling ->read_byte() (Boris) When handling errors we need to bail out before calling ->read_byte(). --- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c index 7ba00b8ab288..60bc1bac7741 100644 --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c @@ -1334,13 +1334,18 @@ static int gpmi_ecc_read_oob(struct mtd_info *mtd, struct nand_chip *chip, int page) { struct gpmi_nand_data *this = nand_get_controller_data(chip); + int ret = 0; dev_dbg(this->dev, "page number is %d\n", page); /* clear the OOB buffer */ memset(chip->oob_poi, ~0, mtd->oobsize); /* Read out the conventional OOB. */ - nand_read_page_op(chip, page, mtd->writesize, NULL, 0); + ret = nand_read_page_op(chip, page, mtd->writesize, NULL, 0); + + if (ret) + return ret; + chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); /* @@ -1350,11 +1355,15 @@ static int gpmi_ecc_read_oob(struct mtd_info *mtd, struct nand_chip *chip, */ if (GPMI_IS_MX23(this)) { /* Read the block mark into the first byte of the OOB buffer. */ - nand_read_page_op(chip, page, 0, NULL, 0); + ret = nand_read_page_op(chip, page, 0, NULL, 0); + + if (ret) + return ret; + chip->oob_poi[0] = chip->read_byte(mtd); } - return 0; + return ret; } static int