Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/raidframe Unlock and free in raid_detach to handle e...



details:   https://anonhg.NetBSD.org/src/rev/c045b4553cf0
branches:  trunk
changeset: 342630:c045b4553cf0
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Jan 02 16:06:25 2016 +0000

description:
Unlock and free in raid_detach to handle error paths.

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 0f8e90878078 -r c045b4553cf0 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Sat Jan 02 16:00:01 2016 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Sat Jan 02 16:06:25 2016 +0000
@@ -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 @@
 
        /* Free the softc */
        aprint_normal_dev(rs->sc_dev, "detached\n");
-       raidunlock(rs);
-       raidput(rs);
 
        return 0;
 }
@@ -3930,7 +3928,17 @@
 
        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



Home | Main Index | Thread Index | Old Index