* [PATCH 1/1] MTD mtdchar: add missing initializer on raw write
@ 2011-06-06 13:50 Peter Wippich
2011-06-06 15:28 ` Artem Bityutskiy
2011-06-06 15:33 ` Artem Bityutskiy
0 siblings, 2 replies; 8+ messages in thread
From: Peter Wippich @ 2011-06-06 13:50 UTC (permalink / raw)
To: linux-mtd
On writes in MODE_RAW the mtd_oob_ops struct is not sufficiently
initialized which may cause nandwrite to fail. With this patch
it is possible to write raw nand/oob data without additional ECC
(either for testing or when some sectors need different oob layout
e.g. bootloader) like
nandwrite -n -r -o /dev/mtd0 <myfile>
Signed-off-by: Peter Wippich <pewi@gw-instruments.de>
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 3f92731..797a34a 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -321,6 +321,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
ops.datbuf = kbuf;
ops.oobbuf = NULL;
ops.len = len;
+ ops.ooboffs = 0;
ret = mtd->write_oob(mtd, *ppos, &ops);
retlen = ops.retlen;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] MTD mtdchar: add missing initializer on raw write
2011-06-06 13:50 [PATCH 1/1] MTD mtdchar: add missing initializer on raw write Peter Wippich
@ 2011-06-06 15:28 ` Artem Bityutskiy
2011-06-07 9:28 ` Ricard Wanderlof
2011-06-06 15:33 ` Artem Bityutskiy
1 sibling, 1 reply; 8+ messages in thread
From: Artem Bityutskiy @ 2011-06-06 15:28 UTC (permalink / raw)
To: Peter Wippich, Ricard Wanderlof; +Cc: linux-mtd
On Mon, 2011-06-06 at 15:50 +0200, Peter Wippich wrote:
> On writes in MODE_RAW the mtd_oob_ops struct is not sufficiently
> initialized which may cause nandwrite to fail. With this patch
> it is possible to write raw nand/oob data without additional ECC
> (either for testing or when some sectors need different oob layout
> e.g. bootloader) like
> nandwrite -n -r -o /dev/mtd0 <myfile>
>
> Signed-off-by: Peter Wippich <pewi@gw-instruments.de>
Looks good, thanks. We also need to add this patch to the stable tree.
Ricard, does it solve the issue you reported here
http://lists.infradead.org/pipermail/linux-mtd/2011-March/034516.html
?
>
> diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
> index 3f92731..797a34a 100644
> --- a/drivers/mtd/mtdchar.c
> +++ b/drivers/mtd/mtdchar.c
> @@ -321,6 +321,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
> ops.datbuf = kbuf;
> ops.oobbuf = NULL;
> ops.len = len;
> + ops.ooboffs = 0;
>
> ret = mtd->write_oob(mtd, *ppos, &ops);
> retlen = ops.retlen;
>
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] MTD mtdchar: add missing initializer on raw write
2011-06-06 13:50 [PATCH 1/1] MTD mtdchar: add missing initializer on raw write Peter Wippich
2011-06-06 15:28 ` Artem Bityutskiy
@ 2011-06-06 15:33 ` Artem Bityutskiy
2011-06-06 15:39 ` Peter Wippich
1 sibling, 1 reply; 8+ messages in thread
From: Artem Bityutskiy @ 2011-06-06 15:33 UTC (permalink / raw)
To: Peter Wippich; +Cc: Ricard Wanderlof, linux-mtd
On Mon, 2011-06-06 at 15:50 +0200, Peter Wippich wrote:
> On writes in MODE_RAW the mtd_oob_ops struct is not sufficiently
> initialized which may cause nandwrite to fail. With this patch
> it is possible to write raw nand/oob data without additional ECC
> (either for testing or when some sectors need different oob layout
> e.g. bootloader) like
> nandwrite -n -r -o /dev/mtd0 <myfile>
>
> Signed-off-by: Peter Wippich <pewi@gw-instruments.de>
Pushed your patch to the l2-mtd-2.6.git tree, thanks. It did not apply,
but I amended it. I guess it is against some old kernel tree. Also, I've
added "Cc: stable@kernel.org" to make sure it reaches the -stable tree.
http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/87d5d1460c4e13636406a613f5740ef5e5cdbbfa
A "Tested-by" would be great!
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] MTD mtdchar: add missing initializer on raw write
2011-06-06 15:33 ` Artem Bityutskiy
@ 2011-06-06 15:39 ` Peter Wippich
2011-06-06 15:44 ` Artem Bityutskiy
0 siblings, 1 reply; 8+ messages in thread
From: Peter Wippich @ 2011-06-06 15:39 UTC (permalink / raw)
To: Artem Bityutskiy; +Cc: Ricard Wanderlof, linux-mtd
Hi Artem,
On Mon, 6 Jun 2011, Artem Bityutskiy wrote:
> On Mon, 2011-06-06 at 15:50 +0200, Peter Wippich wrote:
>> On writes in MODE_RAW the mtd_oob_ops struct is not sufficiently
>> initialized which may cause nandwrite to fail. With this patch
>> it is possible to write raw nand/oob data without additional ECC
>> (either for testing or when some sectors need different oob layout
>> e.g. bootloader) like
>> nandwrite -n -r -o /dev/mtd0 <myfile>
>>
>> Signed-off-by: Peter Wippich <pewi@gw-instruments.de>
>
> Pushed your patch to the l2-mtd-2.6.git tree, thanks. It did not apply,
> but I amended it. I guess it is against some old kernel tree. Also, I've
> added "Cc: stable@kernel.org" to make sure it reaches the -stable tree.
>
> http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/87d5d1460c4e13636406a613f5740ef5e5cdbbfa
>
> A "Tested-by" would be great!
>
>
thanks. Thought it was again linux-next. May be a messed up something.
Next time I'll add a tested by .......
Cheers,
Peter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] MTD mtdchar: add missing initializer on raw write
2011-06-06 15:39 ` Peter Wippich
@ 2011-06-06 15:44 ` Artem Bityutskiy
2011-06-06 15:49 ` Peter Wippich
0 siblings, 1 reply; 8+ messages in thread
From: Artem Bityutskiy @ 2011-06-06 15:44 UTC (permalink / raw)
To: Peter Wippich; +Cc: Ricard Wanderlof, linux-mtd
On Mon, 2011-06-06 at 17:39 +0200, Peter Wippich wrote:
> Next time I'll add a tested by .......
I meant a tested-by from Ricard, as an independent person :-)
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] MTD mtdchar: add missing initializer on raw write
2011-06-06 15:44 ` Artem Bityutskiy
@ 2011-06-06 15:49 ` Peter Wippich
0 siblings, 0 replies; 8+ messages in thread
From: Peter Wippich @ 2011-06-06 15:49 UTC (permalink / raw)
To: Artem Bityutskiy; +Cc: linux-mtd, Ricard Wanderlof
On Mon, 6 Jun 2011, Artem Bityutskiy wrote:
> On Mon, 2011-06-06 at 17:39 +0200, Peter Wippich wrote:
>> Next time I'll add a tested by .......
>
> I meant a tested-by from Ricard, as an independent person :-)
Yep, makes sense :-).
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] MTD mtdchar: add missing initializer on raw write
2011-06-06 15:28 ` Artem Bityutskiy
@ 2011-06-07 9:28 ` Ricard Wanderlof
2011-06-07 9:38 ` Artem Bityutskiy
0 siblings, 1 reply; 8+ messages in thread
From: Ricard Wanderlof @ 2011-06-07 9:28 UTC (permalink / raw)
To: Artem Bityutskiy; +Cc: linux-mtd@lists.infradead.org, Peter Wippich
On Mon, 6 Jun 2011, Artem Bityutskiy wrote:
> On Mon, 2011-06-06 at 15:50 +0200, Peter Wippich wrote:
> On writes in MODE_RAW the mtd_oob_ops struct is not sufficiently
> initialized which may cause nandwrite to fail. With this patch
> it is possible to write raw nand/oob data without additional ECC
> (either for testing or when some sectors need different oob layout
> e.g. bootloader) like
> nandwrite -n -r -o /dev/mtd0 <myfile>
>
> Signed-off-by: Peter Wippich <pewi@gw-instruments.de>
Looks good, thanks. We also need to add this patch to the stable tree.
Ricard, does it solve the issue you reported here
http://lists.infradead.org/pipermail/linux-mtd/2011-March/034516.html
Yes, it does, it seems to work beautifully. The error messages I reported
in the post are gone, nandwrite reports success, and the resulting data in
the flash appears to be ok. Thanks Peter for finding the root cause and
the elegantly trivial patch.
Tested-by: Ricard Wanderlof <ricardw@axis.com>
/Ricard
>
> diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
> index 3f92731..797a34a 100644
> --- a/drivers/mtd/mtdchar.c
> +++ b/drivers/mtd/mtdchar.c
> @@ -321,6 +321,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
> ops.datbuf = kbuf;
> ops.oobbuf = NULL;
> ops.len = len;
> + ops.ooboffs = 0;
>
> ret = mtd->write_oob(mtd, *ppos, &ops);
> retlen = ops.retlen;
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/1] MTD mtdchar: add missing initializer on raw write
2011-06-07 9:28 ` Ricard Wanderlof
@ 2011-06-07 9:38 ` Artem Bityutskiy
0 siblings, 0 replies; 8+ messages in thread
From: Artem Bityutskiy @ 2011-06-07 9:38 UTC (permalink / raw)
To: Ricard Wanderlof; +Cc: linux-mtd@lists.infradead.org, Peter Wippich
On Tue, 2011-06-07 at 11:28 +0200, Ricard Wanderlof wrote:
> Tested-by: Ricard Wanderlof <ricardw@axis.com>
Thank you!
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-06-07 9:43 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-06 13:50 [PATCH 1/1] MTD mtdchar: add missing initializer on raw write Peter Wippich
2011-06-06 15:28 ` Artem Bityutskiy
2011-06-07 9:28 ` Ricard Wanderlof
2011-06-07 9:38 ` Artem Bityutskiy
2011-06-06 15:33 ` Artem Bityutskiy
2011-06-06 15:39 ` Peter Wippich
2011-06-06 15:44 ` Artem Bityutskiy
2011-06-06 15:49 ` Peter Wippich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox