[PATCH] ARM: rpi: avoid NULL dereference on unknown rev.

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

 



"model" pointer is NULL if current board revision isn't in the list of known
boards.
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 650b26ce7..b2febec99 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -180,7 +180,7 @@ const struct rpi_model rpi_models_new_scheme[] = {
 };
 
 static int rpi_board_rev = 0;
-const struct rpi_model *model;
+const struct rpi_model *model = NULL;
 
 static void rpi_get_board_rev(void)
 {
@@ -251,6 +251,9 @@ unknown_rev:
 
 static void rpi_model_init(void)
 {
+	if (!model)
+		return;
+
 	if (!model->init)
 		return;
 
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux