[Fwd: Re: [PATCH] 2/2 mtd: Add support for the Dreamcast VMU flash]

Jörn Engel joern at logfs.org
Thu Mar 20 08:31:39 EDT 2008


On Thu, 20 March 2008 12:56:42 -0000, Adrian McMenamin wrote:
> On Thu, March 20, 2008 11:20 am, Jörn Engel wrote:
> > On Thu, 20 March 2008 11:56:54 -0000, Adrian McMenamin wrote:
> >> >> +
> >> >> +	((unsigned long *)sendbuf)[0] = cpu_to_be32(MAPLE_FUNC_MEMCARD);
> >> >> +	((unsigned long *)sendbuf)[1] = cpu_to_be32(partition << 24 | num);
> > So why do you use void* for data you actually dereference?
> 
> Because for other devices data can be passed as 16 bit structures as well
> as 32 bit ones.

Hogwash!  If you ever deal with 16bit structures here you have a bug.
cpu_to_be32() only makes sense when actually dealing with __be32.
Either your variable is and should be called __be32, or it isn't and you
have a bug right in front of you.

Jörn

-- 
It does not matter how slowly you go, so long as you do not stop.
-- Confucius



More information about the linux-mtd mailing list