13
13
#include <linux/device.h>
14
14
#include <linux/platform_device.h>
15
15
#include <linux/reboot.h>
16
+ #include <linux/slab.h>
16
17
#include <asm/prom.h>
17
18
#include <asm/smu.h>
18
19
@@ -133,14 +134,6 @@ static int create_cpu_loop(int cpu)
133
134
s32 tmax ;
134
135
int fmin ;
135
136
136
- /* Get PID params from the appropriate SAT */
137
- hdr = smu_sat_get_sdb_partition (chip , 0xC8 + core , NULL );
138
- if (hdr == NULL ) {
139
- printk (KERN_WARNING "windfarm: can't get CPU PID fan config\n" );
140
- return - EINVAL ;
141
- }
142
- piddata = (struct smu_sdbp_cpupiddata * )& hdr [1 ];
143
-
144
137
/* Get FVT params to get Tmax; if not found, assume default */
145
138
hdr = smu_sat_get_sdb_partition (chip , 0xC4 + core , NULL );
146
139
if (hdr ) {
@@ -153,6 +146,16 @@ static int create_cpu_loop(int cpu)
153
146
if (tmax < cpu_all_tmax )
154
147
cpu_all_tmax = tmax ;
155
148
149
+ kfree (hdr );
150
+
151
+ /* Get PID params from the appropriate SAT */
152
+ hdr = smu_sat_get_sdb_partition (chip , 0xC8 + core , NULL );
153
+ if (hdr == NULL ) {
154
+ printk (KERN_WARNING "windfarm: can't get CPU PID fan config\n" );
155
+ return - EINVAL ;
156
+ }
157
+ piddata = (struct smu_sdbp_cpupiddata * )& hdr [1 ];
158
+
156
159
/*
157
160
* Darwin has a minimum fan speed of 1000 rpm for the 4-way and
158
161
* 515 for the 2-way. That appears to be overkill, so for now,
@@ -175,6 +178,9 @@ static int create_cpu_loop(int cpu)
175
178
pid .min = fmin ;
176
179
177
180
wf_cpu_pid_init (& cpu_pid [cpu ], & pid );
181
+
182
+ kfree (hdr );
183
+
178
184
return 0 ;
179
185
}
180
186
0 commit comments