[PATCH mtd-utils] nanddump: check write function result for errors

Rafał Miłecki zajec5 at gmail.com
Mon Jul 18 04:59:15 PDT 2016


On 18 July 2016 at 13:33, Richard Weinberger
<richard.weinberger at gmail.com> wrote:
> On Mon, Jul 18, 2016 at 11:18 AM, Rafał Miłecki <zajec5 at gmail.com> wrote:
>> Errors may happen, it's e.g. easy on embedded devices to run out of space
>> when dumping big partitions. This patch adds a helper function for
>> writing. It deals with partial writes and just returns 0 on success or
>> error number.
>>
>> The old code didn't check for errors at all which could result in
>> incomplete dumps without exiting with an error.
>
> Is this patch different from my version, does it fix more?
> http://lists.infradead.org/pipermail/linux-mtd/2016-April/067234.html
>
> Brian, if this is fine with you I'd apply one of these patches.

I wasn't aware of your patch, having it accepted would save me some
time for sure.

Two minor advantages I see in my version:
1) It handles partial writes, just retries if only some part of buffer
has been written
2) It displays error number and string which may provide some extra
hint to the user

In my case (when I was running out of space), the successful last
write was partial because there wasn't enough space for the whole
buffer. I needed to retry a write to get a real error code.

-- 
Rafał



More information about the linux-mtd mailing list