aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-11-07 19:14:20 -0500
committerPaul Mackerras <paulus@samba.org>2005-11-07 19:14:20 -0500
commit24bfb00123e82a2e70bd115277d922438813515b (patch)
tree27328b8a5718e16d64e2d101f4b7ddcad5930aed /arch/sparc64
parentc6135234550ed89a6fd0e8cb229633967e41d649 (diff)
parent3f00d3e8fb963968a922d821a9a53b503b687e81 (diff)
Merge ../linux-2.6
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/Kconfig13
-rw-r--r--arch/sparc64/Kconfig.debug10
-rw-r--r--arch/sparc64/kernel/kprobes.c165
-rw-r--r--arch/sparc64/kernel/us2e_cpufreq.c7
-rw-r--r--arch/sparc64/kernel/us3_cpufreq.c7
-rw-r--r--arch/sparc64/oprofile/Kconfig6
6 files changed, 99 insertions, 109 deletions
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 1e9d8638a28a..3fded69b1922 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -377,8 +377,21 @@ source "drivers/fc4/Kconfig"
377 377
378source "fs/Kconfig" 378source "fs/Kconfig"
379 379
380menu "Instrumentation Support"
381 depends on EXPERIMENTAL
382
380source "arch/sparc64/oprofile/Kconfig" 383source "arch/sparc64/oprofile/Kconfig"
381 384
385config KPROBES
386 bool "Kprobes (EXPERIMENTAL)"
387 help
388 Kprobes allows you to trap at almost any kernel address and
389 execute a callback function. register_kprobe() establishes
390 a probepoint and specifies the callback. Kprobes is useful
391 for kernel debugging, non-intrusive instrumentation and testing.
392 If in doubt, say "N".
393endmenu
394
382source "arch/sparc64/Kconfig.debug" 395source "arch/sparc64/Kconfig.debug"
383 396
384source "security/Kconfig" 397source "security/Kconfig"
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug
index fa06ea04837b..3e31be494e54 100644
--- a/arch/sparc64/Kconfig.debug
+++ b/arch/sparc64/Kconfig.debug
@@ -11,16 +11,6 @@ config DEBUG_STACK_USAGE
11 11
12 This option will slow down process creation somewhat. 12 This option will slow down process creation somewhat.
13 13
14config KPROBES
15 bool "Kprobes"
16 depends on DEBUG_KERNEL
17 help
18 Kprobes allows you to trap at almost any kernel address and
19 execute a callback function. register_kprobe() establishes
20 a probepoint and specifies the callback. Kprobes is useful
21 for kernel debugging, non-intrusive instrumentation and testing.
22 If in doubt, say "N".
23
24config DEBUG_DCFLUSH 14config DEBUG_DCFLUSH
25 bool "D-cache flush debugging" 15 bool "D-cache flush debugging"
26 depends on DEBUG_KERNEL 16 depends on DEBUG_KERNEL
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c
index 0d66d07c8c6e..96bd09b098f4 100644
--- a/arch/sparc64/kernel/kprobes.c
+++ b/arch/sparc64/kernel/kprobes.c
@@ -38,6 +38,9 @@
38 * - Mark that we are no longer actively in a kprobe. 38 * - Mark that we are no longer actively in a kprobe.
39 */ 39 */
40 40
41DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
42DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
43
41int __kprobes arch_prepare_kprobe(struct kprobe *p) 44int __kprobes arch_prepare_kprobe(struct kprobe *p)
42{ 45{
43 return 0; 46 return 0;
@@ -66,46 +69,39 @@ void __kprobes arch_remove_kprobe(struct kprobe *p)
66{ 69{
67} 70}
68 71
69static struct kprobe *current_kprobe; 72static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
70static unsigned long current_kprobe_orig_tnpc;
71static unsigned long current_kprobe_orig_tstate_pil;
72static unsigned int kprobe_status;
73static struct kprobe *kprobe_prev;
74static unsigned long kprobe_orig_tnpc_prev;
75static unsigned long kprobe_orig_tstate_pil_prev;
76static unsigned int kprobe_status_prev;
77
78static inline void save_previous_kprobe(void)
79{ 73{
80 kprobe_status_prev = kprobe_status; 74 kcb->prev_kprobe.kp = kprobe_running();
81 kprobe_orig_tnpc_prev = current_kprobe_orig_tnpc; 75 kcb->prev_kprobe.status = kcb->kprobe_status;
82 kprobe_orig_tstate_pil_prev = current_kprobe_orig_tstate_pil; 76 kcb->prev_kprobe.orig_tnpc = kcb->kprobe_orig_tnpc;
83 kprobe_prev = current_kprobe; 77 kcb->prev_kprobe.orig_tstate_pil = kcb->kprobe_orig_tstate_pil;
84} 78}
85 79
86static inline void restore_previous_kprobe(void) 80static inline void restore_previous_kprobe(struct kprobe_ctlblk *kcb)
87{ 81{
88 kprobe_status = kprobe_status_prev; 82 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
89 current_kprobe_orig_tnpc = kprobe_orig_tnpc_prev; 83 kcb->kprobe_status = kcb->prev_kprobe.status;
90 current_kprobe_orig_tstate_pil = kprobe_orig_tstate_pil_prev; 84 kcb->kprobe_orig_tnpc = kcb->prev_kprobe.orig_tnpc;
91 current_kprobe = kprobe_prev; 85 kcb->kprobe_orig_tstate_pil = kcb->prev_kprobe.orig_tstate_pil;
92} 86}
93 87
94static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs) 88static inline void set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
89 struct kprobe_ctlblk *kcb)
95{ 90{
96 current_kprobe_orig_tnpc = regs->tnpc; 91 __get_cpu_var(current_kprobe) = p;
97 current_kprobe_orig_tstate_pil = (regs->tstate & TSTATE_PIL); 92 kcb->kprobe_orig_tnpc = regs->tnpc;
98 current_kprobe = p; 93 kcb->kprobe_orig_tstate_pil = (regs->tstate & TSTATE_PIL);
99} 94}
100 95
101static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) 96static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs,
97 struct kprobe_ctlblk *kcb)
102{ 98{
103 regs->tstate |= TSTATE_PIL; 99 regs->tstate |= TSTATE_PIL;
104 100
105 /*single step inline, if it a breakpoint instruction*/ 101 /*single step inline, if it a breakpoint instruction*/
106 if (p->opcode == BREAKPOINT_INSTRUCTION) { 102 if (p->opcode == BREAKPOINT_INSTRUCTION) {
107 regs->tpc = (unsigned long) p->addr; 103 regs->tpc = (unsigned long) p->addr;
108 regs->tnpc = current_kprobe_orig_tnpc; 104 regs->tnpc = kcb->kprobe_orig_tnpc;
109 } else { 105 } else {
110 regs->tpc = (unsigned long) &p->ainsn.insn[0]; 106 regs->tpc = (unsigned long) &p->ainsn.insn[0];
111 regs->tnpc = (unsigned long) &p->ainsn.insn[1]; 107 regs->tnpc = (unsigned long) &p->ainsn.insn[1];
@@ -117,19 +113,21 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
117 struct kprobe *p; 113 struct kprobe *p;
118 void *addr = (void *) regs->tpc; 114 void *addr = (void *) regs->tpc;
119 int ret = 0; 115 int ret = 0;
116 struct kprobe_ctlblk *kcb;
120 117
118 /*
119 * We don't want to be preempted for the entire
120 * duration of kprobe processing
121 */
121 preempt_disable(); 122 preempt_disable();
123 kcb = get_kprobe_ctlblk();
122 124
123 if (kprobe_running()) { 125 if (kprobe_running()) {
124 /* We *are* holding lock here, so this is safe.
125 * Disarm the probe we just hit, and ignore it.
126 */
127 p = get_kprobe(addr); 126 p = get_kprobe(addr);
128 if (p) { 127 if (p) {
129 if (kprobe_status == KPROBE_HIT_SS) { 128 if (kcb->kprobe_status == KPROBE_HIT_SS) {
130 regs->tstate = ((regs->tstate & ~TSTATE_PIL) | 129 regs->tstate = ((regs->tstate & ~TSTATE_PIL) |
131 current_kprobe_orig_tstate_pil); 130 kcb->kprobe_orig_tstate_pil);
132 unlock_kprobes();
133 goto no_kprobe; 131 goto no_kprobe;
134 } 132 }
135 /* We have reentered the kprobe_handler(), since 133 /* We have reentered the kprobe_handler(), since
@@ -138,25 +136,22 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
138 * just single step on the instruction of the new probe 136 * just single step on the instruction of the new probe
139 * without calling any user handlers. 137 * without calling any user handlers.
140 */ 138 */
141 save_previous_kprobe(); 139 save_previous_kprobe(kcb);
142 set_current_kprobe(p, regs); 140 set_current_kprobe(p, regs, kcb);
143 p->nmissed++; 141 p->nmissed++;
144 kprobe_status = KPROBE_REENTER; 142 kcb->kprobe_status = KPROBE_REENTER;
145 prepare_singlestep(p, regs); 143 prepare_singlestep(p, regs, kcb);
146 return 1; 144 return 1;
147 } else { 145 } else {
148 p = current_kprobe; 146 p = __get_cpu_var(current_kprobe);
149 if (p->break_handler && p->break_handler(p, regs)) 147 if (p->break_handler && p->break_handler(p, regs))
150 goto ss_probe; 148 goto ss_probe;
151 } 149 }
152 /* If it's not ours, can't be delete race, (we hold lock). */
153 goto no_kprobe; 150 goto no_kprobe;
154 } 151 }
155 152
156 lock_kprobes();
157 p = get_kprobe(addr); 153 p = get_kprobe(addr);
158 if (!p) { 154 if (!p) {
159 unlock_kprobes();
160 if (*(u32 *)addr != BREAKPOINT_INSTRUCTION) { 155 if (*(u32 *)addr != BREAKPOINT_INSTRUCTION) {
161 /* 156 /*
162 * The breakpoint instruction was removed right 157 * The breakpoint instruction was removed right
@@ -171,14 +166,14 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
171 goto no_kprobe; 166 goto no_kprobe;
172 } 167 }
173 168
174 set_current_kprobe(p, regs); 169 set_current_kprobe(p, regs, kcb);
175 kprobe_status = KPROBE_HIT_ACTIVE; 170 kcb->kprobe_status = KPROBE_HIT_ACTIVE;
176 if (p->pre_handler && p->pre_handler(p, regs)) 171 if (p->pre_handler && p->pre_handler(p, regs))
177 return 1; 172 return 1;
178 173
179ss_probe: 174ss_probe:
180 prepare_singlestep(p, regs); 175 prepare_singlestep(p, regs, kcb);
181 kprobe_status = KPROBE_HIT_SS; 176 kcb->kprobe_status = KPROBE_HIT_SS;
182 return 1; 177 return 1;
183 178
184no_kprobe: 179no_kprobe:
@@ -260,11 +255,12 @@ static void __kprobes retpc_fixup(struct pt_regs *regs, u32 insn,
260 * This function prepares to return from the post-single-step 255 * This function prepares to return from the post-single-step
261 * breakpoint trap. 256 * breakpoint trap.
262 */ 257 */
263static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) 258static void __kprobes resume_execution(struct kprobe *p,
259 struct pt_regs *regs, struct kprobe_ctlblk *kcb)
264{ 260{
265 u32 insn = p->ainsn.insn[0]; 261 u32 insn = p->ainsn.insn[0];
266 262
267 regs->tpc = current_kprobe_orig_tnpc; 263 regs->tpc = kcb->kprobe_orig_tnpc;
268 regs->tnpc = relbranch_fixup(insn, 264 regs->tnpc = relbranch_fixup(insn,
269 (unsigned long) p->addr, 265 (unsigned long) p->addr,
270 (unsigned long) &p->ainsn.insn[0], 266 (unsigned long) &p->ainsn.insn[0],
@@ -272,44 +268,48 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
272 retpc_fixup(regs, insn, (unsigned long) p->addr); 268 retpc_fixup(regs, insn, (unsigned long) p->addr);
273 269
274 regs->tstate = ((regs->tstate & ~TSTATE_PIL) | 270 regs->tstate = ((regs->tstate & ~TSTATE_PIL) |
275 current_kprobe_orig_tstate_pil); 271 kcb->kprobe_orig_tstate_pil);
276} 272}
277 273
278static inline int post_kprobe_handler(struct pt_regs *regs) 274static inline int post_kprobe_handler(struct pt_regs *regs)
279{ 275{
280 if (!kprobe_running()) 276 struct kprobe *cur = kprobe_running();
277 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
278
279 if (!cur)
281 return 0; 280 return 0;
282 281
283 if ((kprobe_status != KPROBE_REENTER) && current_kprobe->post_handler) { 282 if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) {
284 kprobe_status = KPROBE_HIT_SSDONE; 283 kcb->kprobe_status = KPROBE_HIT_SSDONE;
285 current_kprobe->post_handler(current_kprobe, regs, 0); 284 cur->post_handler(cur, regs, 0);
286 } 285 }
287 286
288 resume_execution(current_kprobe, regs); 287 resume_execution(cur, regs, kcb);
289 288
290 /*Restore back the original saved kprobes variables and continue. */ 289 /*Restore back the original saved kprobes variables and continue. */
291 if (kprobe_status == KPROBE_REENTER) { 290 if (kcb->kprobe_status == KPROBE_REENTER) {
292 restore_previous_kprobe(); 291 restore_previous_kprobe(kcb);
293 goto out; 292 goto out;
294 } 293 }
295 unlock_kprobes(); 294 reset_current_kprobe();
296out: 295out:
297 preempt_enable_no_resched(); 296 preempt_enable_no_resched();
298 297
299 return 1; 298 return 1;
300} 299}
301 300
302/* Interrupts disabled, kprobe_lock held. */
303static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr) 301static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
304{ 302{
305 if (current_kprobe->fault_handler 303 struct kprobe *cur = kprobe_running();
306 && current_kprobe->fault_handler(current_kprobe, regs, trapnr)) 304 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
305
306 if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
307 return 1; 307 return 1;
308 308
309 if (kprobe_status & KPROBE_HIT_SS) { 309 if (kcb->kprobe_status & KPROBE_HIT_SS) {
310 resume_execution(current_kprobe, regs); 310 resume_execution(cur, regs, kcb);
311 311
312 unlock_kprobes(); 312 reset_current_kprobe();
313 preempt_enable_no_resched(); 313 preempt_enable_no_resched();
314 } 314 }
315 return 0; 315 return 0;
@@ -322,29 +322,30 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
322 unsigned long val, void *data) 322 unsigned long val, void *data)
323{ 323{
324 struct die_args *args = (struct die_args *)data; 324 struct die_args *args = (struct die_args *)data;
325 int ret = NOTIFY_DONE;
326
325 switch (val) { 327 switch (val) {
326 case DIE_DEBUG: 328 case DIE_DEBUG:
327 if (kprobe_handler(args->regs)) 329 if (kprobe_handler(args->regs))
328 return NOTIFY_STOP; 330 ret = NOTIFY_STOP;
329 break; 331 break;
330 case DIE_DEBUG_2: 332 case DIE_DEBUG_2:
331 if (post_kprobe_handler(args->regs)) 333 if (post_kprobe_handler(args->regs))
332 return NOTIFY_STOP; 334 ret = NOTIFY_STOP;
333 break; 335 break;
334 case DIE_GPF: 336 case DIE_GPF:
335 if (kprobe_running() &&
336 kprobe_fault_handler(args->regs, args->trapnr))
337 return NOTIFY_STOP;
338 break;
339 case DIE_PAGE_FAULT: 337 case DIE_PAGE_FAULT:
338 /* kprobe_running() needs smp_processor_id() */
339 preempt_disable();
340 if (kprobe_running() && 340 if (kprobe_running() &&
341 kprobe_fault_handler(args->regs, args->trapnr)) 341 kprobe_fault_handler(args->regs, args->trapnr))
342 return NOTIFY_STOP; 342 ret = NOTIFY_STOP;
343 preempt_enable();
343 break; 344 break;
344 default: 345 default:
345 break; 346 break;
346 } 347 }
347 return NOTIFY_DONE; 348 return ret;
348} 349}
349 350
350asmlinkage void __kprobes kprobe_trap(unsigned long trap_level, 351asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
@@ -368,24 +369,21 @@ asmlinkage void __kprobes kprobe_trap(unsigned long trap_level,
368} 369}
369 370
370/* Jprobes support. */ 371/* Jprobes support. */
371static struct pt_regs jprobe_saved_regs;
372static struct pt_regs *jprobe_saved_regs_location;
373static struct sparc_stackf jprobe_saved_stack;
374
375int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 372int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
376{ 373{
377 struct jprobe *jp = container_of(p, struct jprobe, kp); 374 struct jprobe *jp = container_of(p, struct jprobe, kp);
375 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
378 376
379 jprobe_saved_regs_location = regs; 377 kcb->jprobe_saved_regs_location = regs;
380 memcpy(&jprobe_saved_regs, regs, sizeof(*regs)); 378 memcpy(&(kcb->jprobe_saved_regs), regs, sizeof(*regs));
381 379
382 /* Save a whole stack frame, this gets arguments 380 /* Save a whole stack frame, this gets arguments
383 * pushed onto the stack after using up all the 381 * pushed onto the stack after using up all the
384 * arg registers. 382 * arg registers.
385 */ 383 */
386 memcpy(&jprobe_saved_stack, 384 memcpy(&(kcb->jprobe_saved_stack),
387 (char *) (regs->u_regs[UREG_FP] + STACK_BIAS), 385 (char *) (regs->u_regs[UREG_FP] + STACK_BIAS),
388 sizeof(jprobe_saved_stack)); 386 sizeof(kcb->jprobe_saved_stack));
389 387
390 regs->tpc = (unsigned long) jp->entry; 388 regs->tpc = (unsigned long) jp->entry;
391 regs->tnpc = ((unsigned long) jp->entry) + 0x4UL; 389 regs->tnpc = ((unsigned long) jp->entry) + 0x4UL;
@@ -396,7 +394,6 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
396 394
397void __kprobes jprobe_return(void) 395void __kprobes jprobe_return(void)
398{ 396{
399 preempt_enable_no_resched();
400 __asm__ __volatile__( 397 __asm__ __volatile__(
401 ".globl jprobe_return_trap_instruction\n" 398 ".globl jprobe_return_trap_instruction\n"
402"jprobe_return_trap_instruction:\n\t" 399"jprobe_return_trap_instruction:\n\t"
@@ -410,14 +407,15 @@ extern void __show_regs(struct pt_regs * regs);
410int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 407int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
411{ 408{
412 u32 *addr = (u32 *) regs->tpc; 409 u32 *addr = (u32 *) regs->tpc;
410 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
413 411
414 if (addr == (u32 *) jprobe_return_trap_instruction) { 412 if (addr == (u32 *) jprobe_return_trap_instruction) {
415 if (jprobe_saved_regs_location != regs) { 413 if (kcb->jprobe_saved_regs_location != regs) {
416 printk("JPROBE: Current regs (%p) does not match " 414 printk("JPROBE: Current regs (%p) does not match "
417 "saved regs (%p).\n", 415 "saved regs (%p).\n",
418 regs, jprobe_saved_regs_location); 416 regs, kcb->jprobe_saved_regs_location);
419 printk("JPROBE: Saved registers\n"); 417 printk("JPROBE: Saved registers\n");
420 __show_regs(jprobe_saved_regs_location); 418 __show_regs(kcb->jprobe_saved_regs_location);
421 printk("JPROBE: Current registers\n"); 419 printk("JPROBE: Current registers\n");
422 __show_regs(regs); 420 __show_regs(regs);
423 BUG(); 421 BUG();
@@ -426,12 +424,13 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
426 * first so that UREG_FP is the original one for 424 * first so that UREG_FP is the original one for
427 * the stack frame restore. 425 * the stack frame restore.
428 */ 426 */
429 memcpy(regs, &jprobe_saved_regs, sizeof(*regs)); 427 memcpy(regs, &(kcb->jprobe_saved_regs), sizeof(*regs));
430 428
431 memcpy((char *) (regs->u_regs[UREG_FP] + STACK_BIAS), 429 memcpy((char *) (regs->u_regs[UREG_FP] + STACK_BIAS),
432 &jprobe_saved_stack, 430 &(kcb->jprobe_saved_stack),
433 sizeof(jprobe_saved_stack)); 431 sizeof(kcb->jprobe_saved_stack));
434 432
433 preempt_enable_no_resched();
435 return 1; 434 return 1;
436 } 435 }
437 return 0; 436 return 0;
diff --git a/arch/sparc64/kernel/us2e_cpufreq.c b/arch/sparc64/kernel/us2e_cpufreq.c
index 686e526bec04..b35dc8dc995a 100644
--- a/arch/sparc64/kernel/us2e_cpufreq.c
+++ b/arch/sparc64/kernel/us2e_cpufreq.c
@@ -388,10 +388,8 @@ err_out:
388 kfree(driver); 388 kfree(driver);
389 cpufreq_us2e_driver = NULL; 389 cpufreq_us2e_driver = NULL;
390 } 390 }
391 if (us2e_freq_table) { 391 kfree(us2e_freq_table);
392 kfree(us2e_freq_table); 392 us2e_freq_table = NULL;
393 us2e_freq_table = NULL;
394 }
395 return ret; 393 return ret;
396 } 394 }
397 395
@@ -402,7 +400,6 @@ static void __exit us2e_freq_exit(void)
402{ 400{
403 if (cpufreq_us2e_driver) { 401 if (cpufreq_us2e_driver) {
404 cpufreq_unregister_driver(cpufreq_us2e_driver); 402 cpufreq_unregister_driver(cpufreq_us2e_driver);
405
406 kfree(cpufreq_us2e_driver); 403 kfree(cpufreq_us2e_driver);
407 cpufreq_us2e_driver = NULL; 404 cpufreq_us2e_driver = NULL;
408 kfree(us2e_freq_table); 405 kfree(us2e_freq_table);
diff --git a/arch/sparc64/kernel/us3_cpufreq.c b/arch/sparc64/kernel/us3_cpufreq.c
index 0340041f6143..6d1f9a3c464f 100644
--- a/arch/sparc64/kernel/us3_cpufreq.c
+++ b/arch/sparc64/kernel/us3_cpufreq.c
@@ -249,10 +249,8 @@ err_out:
249 kfree(driver); 249 kfree(driver);
250 cpufreq_us3_driver = NULL; 250 cpufreq_us3_driver = NULL;
251 } 251 }
252 if (us3_freq_table) { 252 kfree(us3_freq_table);
253 kfree(us3_freq_table); 253 us3_freq_table = NULL;
254 us3_freq_table = NULL;
255 }
256 return ret; 254 return ret;
257 } 255 }
258 256
@@ -263,7 +261,6 @@ static void __exit us3_freq_exit(void)
263{ 261{
264 if (cpufreq_us3_driver) { 262 if (cpufreq_us3_driver) {
265 cpufreq_unregister_driver(cpufreq_us3_driver); 263 cpufreq_unregister_driver(cpufreq_us3_driver);
266
267 kfree(cpufreq_us3_driver); 264 kfree(cpufreq_us3_driver);
268 cpufreq_us3_driver = NULL; 265 cpufreq_us3_driver = NULL;
269 kfree(us3_freq_table); 266 kfree(us3_freq_table);
diff --git a/arch/sparc64/oprofile/Kconfig b/arch/sparc64/oprofile/Kconfig
index 5ade19801b97..d8a84088471a 100644
--- a/arch/sparc64/oprofile/Kconfig
+++ b/arch/sparc64/oprofile/Kconfig
@@ -1,7 +1,3 @@
1
2menu "Profiling support"
3 depends on EXPERIMENTAL
4
5config PROFILING 1config PROFILING
6 bool "Profiling support (EXPERIMENTAL)" 2 bool "Profiling support (EXPERIMENTAL)"
7 help 3 help
@@ -19,5 +15,3 @@ config OPROFILE
19 15
20 If unsure, say N. 16 If unsure, say N.
21 17
22endmenu
23