Subject: Re: [PATCH v3] can: sja1000: fix endian on arm

From: Marc Kleine-Budde <[email-masked]>
Date: Thu, 11 Apr 2013 21:21:34 +0200

On 04/11/2013 09:14 PM, Christoph Fritz wrote:
> To get correct endian on arm cpus while reading device tree properties,
> this patch replaces of_get_property() with of_property_read_u32().
> 
> Signed-off-by: Christoph Fritz <[email-masked]>

[...]

> -	prop = of_get_property(np, "nxp,clock-out-frequency", &prop_size);
> -	if (prop && (prop_size == sizeof(u32)) && *prop) {
> -		u32 divider = priv->can.clock.freq * 2 / *prop;
> +	err = of_property_read_u32(np, "nxp,clock-out-frequency", &prop);
> +	if (!err) {

What about checking for "prop != 0" as the original code does?

> +		u32 divider = priv->can.clock.freq * 2 / prop;

To prevent a potential div-by-zero here?

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |