summaryrefslogtreecommitdiff
path: root/arch/arm/boards/raspberry-pi/rpi-common.c
diff options
context:
space:
mode:
authorTomaz Solc <tomaz.solc@tablix.org>2019-02-12 15:51:10 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-02-12 21:15:34 +0100
commit823d116529647af29ccfe8f7dcfc7f4ea43122fe (patch)
tree29d4c9d71b0f4251b93b001d2a77d9d1227eb59e /arch/arm/boards/raspberry-pi/rpi-common.c
parente1483104aa781cee58130d1f803315ae365a2ffe (diff)
downloadbarebox-823d116529647af29ccfe8f7dcfc7f4ea43122fe.tar.gz
ARM: rpi: avoid NULL dereference on unknown rev.
"model" pointer is NULL if current board revision isn't in the list of known boards. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/raspberry-pi/rpi-common.c')
-rw-r--r--arch/arm/boards/raspberry-pi/rpi-common.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 650b26ce7d..b2febec991 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;