From: Boris Brezillon <boris.brezillon@bootlin.com>
To: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Boris Brezillon <boris.brezillon@bootlin.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
linux-mtd@lists.infradead.org
Cc: Joern Engel <joern@lazybastard.org>,
Robert Jarzmik <robert.jarzmik@free.fr>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Kyungmin Park <kyungmin.park@samsung.com>,
Artem Bityutskiy <dedekind1@gmail.com>,
Solarflare linux maintainers <linux-net-drivers@solarflare.com>,
Edward Cree <ecree@solarflare.com>,
Bert Kenward <bkenward@solarflare.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org,
devel@driverdev.osuosl.org,
Miquel Raynal <miquel.raynal@bootlin.com>
Subject: [PATCH 1/5] mtd: Initialize ->fail_addr early in mtd_erase()
Date: Mon, 12 Feb 2018 22:03:07 +0100 [thread overview]
Message-ID: <20180212210311.23244-2-boris.brezillon@bootlin.com> (raw)
In-Reply-To: <20180212210311.23244-1-boris.brezillon@bootlin.com>
mtd_erase() can return an error before ->fail_addr is initialized to
MTD_FAIL_ADDR_UNKNOWN. Move this initialization at the very beginning
of the function.
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
drivers/mtd/mtdcore.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index a1c94526fb88..c87859ff338b 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -953,6 +953,8 @@ EXPORT_SYMBOL_GPL(__put_mtd_device);
*/
int mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
{
+ instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
+
if (!mtd->erasesize || !mtd->_erase)
return -ENOTSUPP;
@@ -961,7 +963,6 @@ int mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
if (!(mtd->flags & MTD_WRITEABLE))
return -EROFS;
- instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN;
if (!instr->len) {
instr->state = MTD_ERASE_DONE;
mtd_erase_callback(instr);
--
2.14.1
next prev parent reply other threads:[~2018-02-12 21:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 21:03 [PATCH 0/5] mtd: Simplify erase handling Boris Brezillon
2018-02-12 21:03 ` Boris Brezillon [this message]
2018-02-12 21:47 ` [PATCH 1/5] mtd: Initialize ->fail_addr early in mtd_erase() Richard Weinberger
2018-03-18 21:22 ` Boris Brezillon
2018-02-12 21:03 ` [PATCH 2/5] mtd: Get rid of unused fields in struct erase_info Boris Brezillon
2018-02-12 21:47 ` Richard Weinberger
2018-02-12 21:03 ` [PATCH 3/5] mtd: Stop assuming mtd_erase() is asynchronous Boris Brezillon
2018-02-12 21:58 ` Richard Weinberger
2018-02-12 21:03 ` [PATCH 4/5] mtd: Unconditionally update ->fail_addr and ->addr in part_erase() Boris Brezillon
2018-02-12 22:05 ` Richard Weinberger
2018-02-12 21:03 ` [PATCH 5/5] mtd: Stop updating erase_info->state and calling mtd_erase_callback() Boris Brezillon
2018-02-12 22:17 ` Richard Weinberger
2018-02-13 7:42 ` Miquel Raynal
2018-02-13 8:17 ` Boris Brezillon
2018-02-13 8:33 ` Miquel Raynal
2018-02-13 12:09 ` Bert Kenward
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180212210311.23244-2-boris.brezillon@bootlin.com \
--to=boris.brezillon@bootlin.com \
--cc=benh@kernel.crashing.org \
--cc=bkenward@solarflare.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=dedekind1@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=dwmw2@infradead.org \
--cc=ecree@solarflare.com \
--cc=gregkh@linuxfoundation.org \
--cc=joern@lazybastard.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-net-drivers@solarflare.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=paulus@samba.org \
--cc=richard@nod.at \
--cc=robert.jarzmik@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).