diff options
author | Joel Stanley <joel@jms.id.au> | 2016-02-11 15:38:25 +1030 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2016-02-23 17:41:14 +1100 |
commit | 1aa518748a407453eab70b4d4653fbdda60b9e42 (patch) | |
tree | e268b19ed0337179996dacffabc2ce7ce9d3ae1d | |
parent | 934ae908f94cf7f5b4153c1c87395eecf642f30f (diff) | |
download | blackbird-skiboot-1aa518748a407453eab70b4d4653fbdda60b9e42.tar.gz blackbird-skiboot-1aa518748a407453eab70b4d4653fbdda60b9e42.zip |
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>
-rw-r--r-- | hw/occ.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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; |