summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authormlelstv <mlelstv@NetBSD.org>2016-01-02 16:06:25 +0000
committermlelstv <mlelstv@NetBSD.org>2016-01-02 16:06:25 +0000
commit9a997e85bd17f014178df1825aba76013724b559 (patch)
tree897b26f4113f461e0b09f146dd1a2f39b14f2a5e /sys/dev
parentc66606570192532fb45a0c2c514ad4f90ac0df95 (diff)
Unlock and free in raid_detach to handle error paths.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/raidframe/rf_netbsdkintf.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c
index 4bbc7759d43..d01f7d654c9 100644
--- a/sys/dev/raidframe/rf_netbsdkintf.c
+++ b/sys/dev/raidframe/rf_netbsdkintf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.331 2016/01/02 16:00:01 mlelstv Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.332 2016/01/02 16:06:25 mlelstv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.331 2016/01/02 16:00:01 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.332 2016/01/02 16:06:25 mlelstv Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1039,8 +1039,6 @@ raid_detach_unlocked(struct raid_softc *rs)
/* Free the softc */
aprint_normal_dev(rs->sc_dev, "detached\n");
- raidunlock(rs);
- raidput(rs);
return 0;
}
@@ -3930,7 +3928,17 @@ raid_detach(device_t self, int flags)
error = raid_detach_unlocked(rs);
- return error;
+ raidunlock(rs);
+
+ /* XXX raid can be referenced here */
+
+ if (error)
+ return error;
+
+ /* Free the softc */
+ raidput(rs);
+
+ return 0;
}
static void