diff mbox series

[2/4] phb4: Remove pointless NULL checks

Message ID 20181127062119.15775-2-oohall@gmail.com
State Superseded
Headers show
Series [1/4] phb4: Rework BDFN filtering in phb4_set_pe() | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master

Commit Message

Oliver O'Halloran Nov. 27, 2018, 6:21 a.m. UTC
When we allocate the various in-memory tables we assert() on the
allocation. There's no point in checking if the table pointer is NULL
or not at runtime.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 hw/phb4.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

Comments

Andrew Donnellan Nov. 28, 2018, 4:23 a.m. UTC | #1
On 27/11/18 5:21 pm, Oliver O'Halloran wrote:
> When we allocate the various in-memory tables we assert() on the
> allocation. There's no point in checking if the table pointer is NULL
> or not at runtime.
> 
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
diff mbox series

Patch

diff --git a/hw/phb4.c b/hw/phb4.c
index b26f57277f04..bb03e413a76b 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -1165,10 +1165,8 @@  static int64_t phb4_ioda_reset(struct phb *phb, bool purge)
 	/* Additional OPAL specific inits */
 
 	/* Clear RTT and PELTV and PEST */
-	if (p->tbl_rtt)
-		memcpy((void *)p->tbl_rtt, p->rte_cache, RTT_TABLE_SIZE);
-	if (p->tbl_peltv)
-		memcpy((void *)p->tbl_peltv, p->peltv_cache, p->tbl_peltv_size);
+	memcpy((void *)p->tbl_rtt, p->rte_cache, RTT_TABLE_SIZE);
+	memcpy((void *)p->tbl_peltv, p->peltv_cache, p->tbl_peltv_size);
 
 	/* Clear PEST & PEEV */
 	for (i = 0; i < p->max_num_pes; i++) {
@@ -2168,8 +2166,6 @@  static int64_t phb4_set_pe(struct phb *phb,
 	uint16_t *rte;
 
 	/* Sanity check */
-	if (!p->tbl_rtt)
-		return OPAL_HARDWARE;
 	if (action != OPAL_MAP_PE && action != OPAL_UNMAP_PE)
 		return OPAL_PARAMETER;
 	if (pe_number >= p->num_pes || bdfn > 0xffff ||
@@ -2219,8 +2215,6 @@  static int64_t phb4_set_peltv(struct phb *phb,
 	uint32_t idx, mask;
 
 	/* Sanity check */
-	if (!p->tbl_peltv)
-		return OPAL_HARDWARE;
 	if (parent_pe >= p->num_pes || child_pe >= p->num_pes)
 		return OPAL_PARAMETER;
 
@@ -3723,10 +3717,6 @@  static int64_t phb4_err_inject(struct phb *phb, uint64_t pe_number,
 			   uint64_t addr, uint64_t mask, bool is_write);
 	bool is_write;
 
-	/* How could we get here without valid RTT? */
-	if (!p->tbl_rtt)
-		return OPAL_HARDWARE;
-
 	/* We can't inject error to the reserved PE */
 	if (pe_number == PHB4_RESERVED_PE_NUM(p) || pe_number >= p->num_pes)
 		return OPAL_PARAMETER;