Re: [PATCH V2] staging: vchiq_2835_arm: Make cache-line-size a required DT property

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

 



On Sat, 2017-02-18 at 03:22 -0800, Michael Zoran wrote:
> The original github source allowed for the cache-line-size property
> to be missing.  Since recent firmwares also require this property,
> it makes sense to always require it in the driver as well.
> 
> 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.
> 
> Changes V2:
> 	1. Add error message if cache-line-size is missing.
> 	2. Simple check for non-zero return value from 
> 	   of_property_read_u32.
> 
> Signed-off-by: Michael Zoran <mzoran@xxxxxxxxxxxx>
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c    |
> 8 +++++++-
>  1 file changed, 7 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..3aeffcb9c87e 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,14 @@ 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) {
> +		dev_err(dev, "Missing cache-line-size property\n");
> +		return -ENODEV;
> +	}
> +
>  	g_fragments_size = 2 * g_cache_line_size;
>  
>  	/* Allocate space for the channels in coherent memory */

If anybody is willing to add an Reviewed-by, Acked, or even tested-by
to this it would be great.  I know gregk is a busy guy so it might make
sense to make a note that someone else looked at this and that I'm not
out in left field.

It would be really great if this made it into 4.11.  I'm a bit
concerned about someone accidently trying to mix this driver with an
ancient DT. Things would probably sort of work if that was done, but it
would result in difficult to debug errors.
_______________________________________________
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