summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Latifi <pat@cvs.openbsd.org>2006-05-02 16:14:52 +0000
committerPatrick Latifi <pat@cvs.openbsd.org>2006-05-02 16:14:52 +0000
commit11fca9d0f4d5ce951d24ceaa6de0f7ac1ec86466 (patch)
tree769db83215f89370eb83b6f4afb1ef488cc8b029
parent729b086cb8b5790413557e648a0761219b2a4c47 (diff)
* Plug memory leak if init fails; ok gwk@
-rw-r--r--sys/arch/i386/i386/powernow-k7.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/arch/i386/i386/powernow-k7.c b/sys/arch/i386/i386/powernow-k7.c
index 68fd605dfdf..f206fc5066c 100644
--- a/sys/arch/i386/i386/powernow-k7.c
+++ b/sys/arch/i386/i386/powernow-k7.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: powernow-k7.c,v 1.19 2006/04/18 03:29:47 gwk Exp $ */
+/* $OpenBSD: powernow-k7.c,v 1.20 2006/05/02 16:14:51 pat Exp $ */
/*
* Copyright (c) 2004 Martin Végiard.
@@ -328,10 +328,6 @@ k7_powernow_init(void)
ci = curcpu();
- cstate = malloc(sizeof(struct k7pnow_cpu_state), M_DEVBUF, M_NOWAIT);
- if (!cstate)
- return;
-
cpuid(0x80000000, regs);
if (regs[0] < 0x80000007)
return;
@@ -340,6 +336,10 @@ k7_powernow_init(void)
if (!(regs[3] & AMD_PN_FID_VID))
return;
+ cstate = malloc(sizeof(struct k7pnow_cpu_state), M_DEVBUF, M_NOWAIT);
+ if (!cstate)
+ return;
+
cstate->flags = 0;
if (ci->ci_signature == AMD_ERRATA_A0_CPUSIG)
cstate->flags |= PN7_FLAG_ERRATA_A0;