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

Wolfgang Denk wd at denx.de
Thu Feb 7 00:21:21 CET 2013


Dear Lubomir Rintel,

In message <1360191866.3594.10.camel at unicorn> you wrote:
>
> > > -		if (mtd_type != MTD_DATAFLASH)
> > > +		if (mtd_type && mtd_type != MTD_DATAFLASH)
> > 
> > This change appears to be redundant.  If mtd_type is null, then this
> > is already caught iun te test mtd_type != MTD_DATAFLASH, isn't it?
> 
> No. We don't want the erase ioctl to be called for non-MTD devices and
> files (where mtd_type is null).

I see.  But you are misusing mtd_type.

You should define something like MTD_NO_FLASH or so, and use that.

> > > -		perror ("Cannot get MTD information");
> > > +		perror ("Cannot access MTD device");
> > 
> > I don't understand this.  You talk about a MTD device here, but expect
> > that MEMGETINFO will not work on it?  Please explain in which exact
> > circumstances such a situation wouldhappen.
> 
> The error message (mention of MTD at that point) is incorrect. fstat()

So it needs to be fixed.

> > >  	if (mtdinfo.type != MTD_NORFLASH &&
> > >  	    mtdinfo.type != MTD_NANDFLASH &&
> > > -	    mtdinfo.type != MTD_DATAFLASH) {
> > > +	    mtdinfo.type != MTD_DATAFLASH &&
> > > +	    mtdinfo.type) {
> > 
> > Again, this last line appears to be redundant.
> 
> The same response again -- if the type is nul, then the device is not a
> flash device at all.

See above.  Please make the code sonsistent and define a proper name
for this type.

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
If A equals success, then the formula is A = X + Y + Z. X is work.  Y
is play. Z is keep your mouth shut.                 - Albert Einstein


More information about the U-Boot mailing list