[U-Boot] [PATCH] env: Allow accessing non-mtd devices

Wolfgang Denk wd at denx.de
Thu Feb 7 17:58:19 CET 2013


Dear Lubomir,

In message <1360244552.29426.9.camel at hobbes> you wrote:
>
> > You should define something like MTD_NO_FLASH or so, and use that.
> 
> I found it a bit more abusive to use a MTD_* macro in mtd_type variable
> for something what is not actually a type of a MTD device, specially
> when a change in MTD ABI would be needed.

But that's exactly what you are doing here, just in a way that it is
not even visible.  By assigning a mtd_type value of 0, you are setting
it to MTD_ABSENT - but you don't write MTD_ABSENT.

This is even more dangerous.

> Maybe passing a NULL mtd_info_user pointer to flash_{read,write}_buf()
> instead of zero type (which happens to be MTD_ABSENT, and, as you
> pointed out, a misuse) would make more sense for a non-MTD file?

I don't have any real problems with using MTD_ABSENT - it even makes
kind of sense.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Beware of programmers carrying screwdrivers."      - Chip Salzenberg


More information about the U-Boot mailing list