From: Brian Norris <computersforpeace@gmail.com>
To: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
David Woodhouse <David.Woodhouse@intel.com>,
Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
Pekon Gupta <pekon.gupta@gmail.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Zhou Wang <wangzhou1@hisilicon.com>
Subject: Re: [PATCH] mtd: nand: Disable subpage writes for drivers without ecc->hwctl
Date: Fri, 11 Dec 2015 16:40:25 -0800 [thread overview]
Message-ID: <20151212004025.GA3047@localhost> (raw)
In-Reply-To: <CAGXE3d_v9hKCqNeTWfjpad_Uj=sKo1fn0B=Wz2s_t76JKUZhzQ@mail.gmail.com>
On Thu, Dec 10, 2015 at 10:31:32AM +0100, Helmut Schaa wrote:
> On Thu, Dec 10, 2015 at 12:58 AM, Brian Norris
> <computersforpeace@gmail.com> wrote:
> > On Wed, Apr 09, 2014 at 11:13:24AM +0200, Helmut Schaa wrote:
> >> nand_write_subpage_hwecc causes a crash if the driver did not register
> >> ecc->hwctl or ecc->calculate. Fix this by disabling subpage writes if
> >> ecc->hwctl or ecc->calculate is not provided by the driver.
> >>
> >> This behavior was introduced in commit 837a6ba4f3b6d23026674e6af6b6849a4634fff9
> >> "mtd: nand: subpage write support for hardware based ECC schemes".
> >>
> >> This fixes a crash with fsl_elbc_nand and maybe others:
> >>
> > [...]
> >>
> >> --- a/drivers/mtd/nand/nand_base.c
> >> +++ b/drivers/mtd/nand/nand_base.c
> >> @@ -3768,7 +3768,7 @@ int nand_scan_tail(struct mtd_info *mtd)
> >> ecc->write_oob = nand_write_oob_std;
> >> if (!ecc->read_subpage)
> >> ecc->read_subpage = nand_read_subpage;
> >> - if (!ecc->write_subpage)
> >> + if (!ecc->write_subpage && ecc->hwctl && ecc->calculate)
> >> ecc->write_subpage = nand_write_subpage_hwecc;
> >>
> >> case NAND_ECC_HW_SYNDROME:
> >
> > I realize we've merged a fix for fsl_elbc_nand long ago (commit
> > f034d87def51 "mtd: eLBC NAND: fix subpage write support"), but this
> > change still looks sane, applies, and could possibly fix some other
> > drivers that are lurking somewhere. Any reason I shouldn't apply it?
>
> I'm not carrying this patch in my tree anymore and did not see any more
> crashes with the flash configuration I'm using. So, I think the original patch
> is kind of superfluous.
There could easily be other drivers that don't have hwctl() or
calculate() callbacks yet use NAND_ECC_HW. By inspection, I see that
maybe the new hisi504_nand.c is susceptible, as well as sh_flctl.c and
maybe even sunxi_nand.c (?). Some of these might not be hit if they
don't use NAND that support subpage writes.
Anyway, I think this patch is helpful, because it prevents drivers from
having to fill in a 'subpage' write callback that looks just like their
write_page() callback.
Brian
next prev parent reply other threads:[~2015-12-12 0:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-09 9:13 [PATCH] mtd: nand: Disable subpage writes for drivers without ecc->hwctl Helmut Schaa
2014-04-09 9:38 ` Gupta, Pekon
2014-04-09 10:06 ` Helmut Schaa
2014-04-09 10:33 ` Gupta, Pekon
2014-04-09 11:57 ` Helmut Schaa
2014-04-09 23:34 ` Scott Wood
2014-04-10 4:19 ` Gupta, Pekon
2014-04-10 20:47 ` Scott Wood
2014-04-10 6:45 ` Helmut Schaa
2014-04-10 7:26 ` Gupta, Pekon
2014-04-10 15:22 ` Helmut Schaa
2014-04-11 6:35 ` Gupta, Pekon
2014-04-11 20:10 ` Scott Wood
2014-04-14 5:55 ` Gupta, Pekon
2014-04-14 6:18 ` Helmut Schaa
2014-05-05 8:46 ` Gupta, Pekon
2014-05-05 16:08 ` Helmut Schaa
2015-12-09 23:58 ` Brian Norris
2015-12-10 9:31 ` Helmut Schaa
2015-12-12 0:40 ` Brian Norris [this message]
2015-12-12 7:59 ` Boris Brezillon
2015-12-14 14:04 ` Helmut Schaa
2015-12-19 2:19 ` Brian Norris
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=20151212004025.GA3047@localhost \
--to=computersforpeace@gmail.com \
--cc=David.Woodhouse@intel.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=boris.brezillon@free-electrons.com \
--cc=geert+renesas@glider.be \
--cc=helmut.schaa@googlemail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=pekon.gupta@gmail.com \
--cc=wangzhou1@hisilicon.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.