aboutsummaryrefslogtreecommitdiff
path: root/hw/occ.c
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2016-02-11 15:38:25 +1030
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-02-23 17:41:14 +1100
commit1aa518748a407453eab70b4d4653fbdda60b9e42 (patch)
treee268b19ed0337179996dacffabc2ce7ce9d3ae1d /hw/occ.c
parent934ae908f94cf7f5b4153c1c87395eecf642f30f (diff)
downloadskiboot-1aa518748a407453eab70b4d4653fbdda60b9e42.zip
skiboot-1aa518748a407453eab70b4d4653fbdda60b9e42.tar.gz
skiboot-1aa518748a407453eab70b4d4653fbdda60b9e42.tar.bz2
hw/occ: Only allocate what we need for pstate dt
When constructing the pstate entries in the device tree we allocate MAX_PSTATES, even though we know that there are nr_pstates. Use this information to allocate nr_pstates and potentially save us some heap. Signed-off-by: Joel Stanley <joel@jms.id.au> Acked-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/occ.c')
-rw-r--r--hw/occ.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/occ.c b/hw/occ.c
index 987d007..03240b3 100644
--- a/hw/occ.c
+++ b/hw/occ.c
@@ -207,25 +207,25 @@ static bool add_cpu_pstate_properties(s8 *pstate_nom)
/* Setup arrays for device-tree */
/* Allocate memory */
- dt_id = (u32 *) malloc(MAX_PSTATES * sizeof(u32));
+ dt_id = malloc(nr_pstates * sizeof(u32));
if (!dt_id) {
printf("OCC: dt_id array alloc failure\n");
goto out;
}
- dt_freq = (u32 *) malloc(MAX_PSTATES * sizeof(u32));
+ dt_freq = malloc(nr_pstates * sizeof(u32));
if (!dt_freq) {
printf("OCC: dt_freq array alloc failure\n");
goto out_free_id;
}
- dt_vdd = (u8 *) malloc(MAX_PSTATES * sizeof(u8));
+ dt_vdd = malloc(nr_pstates * sizeof(u8));
if (!dt_vdd) {
printf("OCC: dt_vdd array alloc failure\n");
goto out_free_freq;
}
- dt_vcs = (u8 *) malloc(MAX_PSTATES * sizeof(u8));
+ dt_vcs = malloc(nr_pstates * sizeof(u8));
if (!dt_vcs) {
printf("OCC: dt_vcs array alloc failure\n");
goto out_free_vdd;