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

Michael Zoran mzoran at crowfest.net
Fri Feb 17 16:03:35 PST 2017


This appears to be an ancient issue with the old github.com sources.

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;
+
 	g_fragments_size = 2 * g_cache_line_size;
 
 	/* Allocate space for the channels in coherent memory */
-- 
2.11.0




More information about the linux-rpi-kernel mailing list