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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Michael,

> Michael Zoran <mzoran@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux