[PATCH 16/20] imx27: define and use MX27_IO_ADDRESS

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Thu Dec 17 05:05:26 EST 2009


Hello Lother,

On Thu, Dec 17, 2009 at 08:06:36AM +0100, Lothar Waßmann wrote:
> > +#define MX27_IO_ADDRESS(x)						\
> > +	(void __force __iomem *) ( 					\
> > +	IMX_IO_ADDRESS(x, MX27_AIPI) ?:					\
> > +	IMX_IO_ADDRESS(x, MX27_SAHB1) ?:				\
> > +	IMX_IO_ADDRESS(x, MX27_X_MEMC) ?:				\
> > +	0xdeadbeef)
>         ^^^^^^^^^^
> I prefer to have a plain '0' here. Otherwise an invocation of this
> macro with an illegal address could lead to silent corruption of
> memory that happens to be mapped at that virtual address instead of a
> kernel oops due to a null pointer dereference!
> 
> Same for the other processors.
I'm a bit undecided here.  I choosed 0xdeadbeef because it is used in
IO_ADDRESS, too.  It's not aligned, so probably nothing happens.  As
Sasche votes for 0, too, I can change it.  It simplifies the code a bit
and then can read:

#define MX27_IO_ADDRESS(x)					\
	(void __force __iomem *) (				\
	IMX_IO_ADDRESS(x, MX27_AIPI) ?:				\
	IMX_IO_ADDRESS(x, MX27_SAHB1) ?:			\
	IMX_IO_ADDRESS(x, MX27_X_MEMC))

as IMX_IO_ADDRESS returns 0 for out-of-range values, too.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |



More information about the linux-arm-kernel mailing list