[PATCH] staging: vc04_services: fix missing check of return value for query of dt_node property

Stefan Wahren stefan.wahren at i2se.com
Sat Feb 18 01:42:34 PST 2017


Hi Michael,

> Michael Zoran <mzoran at crowfest.net> hat am 18. Februar 2017 um 01:03 geschrieben:
> 
> 
> This appears to be an ancient issue with the old github.com sources.

no, in the old sources DT binding was optional [1]. But now it should be mandatory and i think cache-line-size should be a required property, too.

> 
> If the cache-line-size property is missing, then the driver probe 
> should fail as no dev since the kernel and dt may be out of sync. 
> 
> The fix is to add a check for the return value of 
> of_property_read_u32.
> 
> Signed-off-by: Michael Zoran <mzoran at crowfest.net>
> ---
>  drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
> index e6241fb5cfa6..1f800f833fbe 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
> @@ -121,8 +121,12 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state)
>  	if (err < 0)
>  		return err;
>  
> -	(void)of_property_read_u32(dev->of_node, "cache-line-size",
> +	err = of_property_read_u32(dev->of_node, "cache-line-size",
>  				   &g_cache_line_size);
> +
> +	if (err < 0)
> +		return -ENODEV;
> +

Please provide a error message about the missing cache-line-size property.

My suggestion for a subject:

staging: vchiq_2835_arm: Make cache-line-size a required DT property

Btw cache-line-size is a well-defined property of the cpu node (not intended for the vchiq node), but this should be a different patch.

Thanks

[1] - https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c?id=bea845af8d877310bbbacd54e8252566019d5a5e

>  	g_fragments_size = 2 * g_cache_line_size;
>  
>  	/* Allocate space for the channels in coherent memory */
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> linux-rpi-kernel mailing list
> linux-rpi-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel



More information about the linux-rpi-kernel mailing list