[Skiboot] [PATCH] hdat: logically dead code, assert instead
Stewart Smith
stewart at linux.vnet.ibm.com
Wed Sep 20 14:27:34 AEST 2017
Since we already assert that base != NULL, the if()
condition on hdif can never be NULL. Instead, we should
just assert (if even that) if it is.
Found by Coverity
Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
hdata/spira.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hdata/spira.c b/hdata/spira.c
index 525376809f55..7be53b9b088b 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -313,8 +313,7 @@ static const void *xscom_to_pcrd(struct dt_node *xscom, int idata_index)
assert(i < be16_to_cpu(t->act_cnt));
hdif = base + i * be32_to_cpu(t->alloc_len);
- if (!hdif)
- return NULL;
+ assert(hdif);
if (idata_index == GET_HDIF_HDR)
return hdif;
--
2.13.5
More information about the Skiboot
mailing list