aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-11-09 11:44:10 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-11-13 23:48:52 -0600
commit8ca2d61f3b4bac88d9d676bf305f1ee2956ce6ad (patch)
treee4a51e867e263b492ec417521533fcc46aa96610
parenta2f15d75c20f9a5912809094f52d532b5c7cff88 (diff)
downloadskiboot-8ca2d61f3b4bac88d9d676bf305f1ee2956ce6ad.zip
skiboot-8ca2d61f3b4bac88d9d676bf305f1ee2956ce6ad.tar.gz
skiboot-8ca2d61f3b4bac88d9d676bf305f1ee2956ce6ad.tar.bz2
npu2: Remove side effects in assert() calls.
This likely looks intentional and will do the correct thing. The correct behaviour does rely on the fact that skiboot has a custom assert() which will always generate code. 'Regular' assert() can be made to generate no code. If we were to do that with this code, the results would be, interesting! This patch will also keep Coverity happy which is nice. Fixes: CID 145242, 172044 and 172045 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/npu2.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/hw/npu2.c b/hw/npu2.c
index ea0e417..8fd6246 100644
--- a/hw/npu2.c
+++ b/hw/npu2.c
@@ -1302,7 +1302,8 @@ static void npu2_probe_phb(struct dt_node *dn)
/* Retrieve chip id */
path = dt_get_path(dn);
gcid = dt_get_chip_id(dn);
- assert(proc_chip = get_chip(gcid));
+ proc_chip = get_chip(gcid);
+ assert(proc_chip);
if ((proc_chip->ec_level & 0xf0) > 0x20) {
prerror("NPU2: unsupported ec level on Chip 0x%x!\n", gcid);
return;
@@ -1677,9 +1678,12 @@ static void npu2_add_interrupt_map(struct npu2 *p,
size_t map_size;
uint32_t mask[] = {0xff00, 0x0, 0x0, 0x7};
+ assert(p->phb.dt_node);
+ phb_dn = p->phb.dt_node;
+
npu2_phandle = dt_prop_get_u32(dn, "ibm,npcq");
- assert((npu2_dn = dt_find_by_phandle(dt_root, npu2_phandle)));
- assert((phb_dn = p->phb.dt_node));
+ npu2_dn = dt_find_by_phandle(dt_root, npu2_phandle);
+ assert(npu2_dn);
map_size = 7 * sizeof(*map) * p->total_devices;
map = malloc(map_size);
index = 0;