aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2017-07-04 11:26:19 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-07-04 11:27:30 +1000
commit8f51ce1b4a0bc5740cbf85653fb64ac34973f4e8 (patch)
treec8f5cc684288445e519554480087bccedc154092
parent270cdf9b6809bfb5f9b3e264660c80c0c2eefc2e (diff)
downloadskiboot-8f51ce1b4a0bc5740cbf85653fb64ac34973f4e8.zip
skiboot-8f51ce1b4a0bc5740cbf85653fb64ac34973f4e8.tar.gz
skiboot-8f51ce1b4a0bc5740cbf85653fb64ac34973f4e8.tar.bz2
hw/fsi-master: check zalloc return value
If we can't allocate enough memory for each chip struct mfsi, we're not going to go so well during boot, so just assert that we allocated the memory. Found by static analysis Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/fsi-master.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/fsi-master.c b/hw/fsi-master.c
index a13af44..db433aa 100644
--- a/hw/fsi-master.c
+++ b/hw/fsi-master.c
@@ -1,4 +1,4 @@
-/* Copyright 2013-2014 IBM Corp.
+/* Copyright 2013-2017 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -677,6 +677,7 @@ void mfsi_init(void)
for_each_chip(chip) {
chip->fsi_masters = zalloc(sizeof(struct mfsi) * 3);
+ assert(chip->fsi_masters);
mfsi_add(chip, &chip->fsi_masters[MFSI_cMFSI0], MFSI_cMFSI0);
mfsi_add(chip, &chip->fsi_masters[MFSI_hMFSI0], MFSI_hMFSI0);
mfsi_add(chip, &chip->fsi_masters[MFSI_cMFSI1], MFSI_cMFSI1);