diff options
| author | riastradh <riastradh@NetBSD.org> | 2023-05-10 00:07:58 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2023-05-10 00:07:58 +0000 |
| commit | 90dede2af20148fb7d99becf075e0b9565d934aa (patch) | |
| tree | 7e17d179b0437cfa8ad9bee9e035d8349d40088a /sys | |
| parent | 29a7a8ed9446f7945ba39f033fef924e9c8f8b12 (diff) | |
mips: Use config_detach_children to reduce error branch bugs.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/arch/mips/ralink/ralink_cfi.c | 15 | ||||
| -rw-r--r-- | sys/arch/mips/rmi/rmixl_nand.c | 15 |
2 files changed, 16 insertions, 14 deletions
diff --git a/sys/arch/mips/ralink/ralink_cfi.c b/sys/arch/mips/ralink/ralink_cfi.c index c2683b6e77c..9fad82ac97c 100644 --- a/sys/arch/mips/ralink/ralink_cfi.c +++ b/sys/arch/mips/ralink/ralink_cfi.c @@ -1,4 +1,4 @@ -/* $NetBSD: ralink_cfi.c,v 1.1 2011/08/02 03:38:48 cliff Exp $ */ +/* $NetBSD: ralink_cfi.c,v 1.2 2023/05/10 00:07:58 riastradh Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -36,7 +36,7 @@ #include "locators.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ralink_cfi.c,v 1.1 2011/08/02 03:38:48 cliff Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ralink_cfi.c,v 1.2 2023/05/10 00:07:58 riastradh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -178,14 +178,15 @@ static int ra_cfi_detach(device_t self, int flags) { struct ra_cfi_softc *sc = device_private(self); - int rv = 0; + int error; - pmf_device_deregister(self); + error = config_detach_children(self, flags); + if (error) + return error; - if (sc->sc_nordev != NULL) - rv = config_detach(sc->sc_nordev, flags); + pmf_device_deregister(self); bus_space_unmap(sc->sc_cfi.cfi_bst, sc->sc_cfi.cfi_bsh, sc->sc_size); - return rv; + return 0; } diff --git a/sys/arch/mips/rmi/rmixl_nand.c b/sys/arch/mips/rmi/rmixl_nand.c index f0e91caaa24..37148dd352d 100644 --- a/sys/arch/mips/rmi/rmixl_nand.c +++ b/sys/arch/mips/rmi/rmixl_nand.c @@ -1,4 +1,4 @@ -/* $NetBSD: rmixl_nand.c,v 1.7 2011/07/01 19:01:31 dyoung Exp $ */ +/* $NetBSD: rmixl_nand.c,v 1.8 2023/05/10 00:07:58 riastradh Exp $ */ /*- * Copyright (c) 2010 Department of Software Engineering, @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rmixl_nand.c,v 1.7 2011/07/01 19:01:31 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rmixl_nand.c,v 1.8 2023/05/10 00:07:58 riastradh Exp $"); #include "opt_flash.h" @@ -235,16 +235,17 @@ static int rmixl_nand_detach(device_t self, int flags) { struct rmixl_nand_softc *sc = device_private(self); - int rv = 0; + int error; - pmf_device_deregister(self); + error = config_detach_children(self, flags); + if (error) + return error; - if (sc->sc_nanddev != NULL) - rv = config_detach(sc->sc_nanddev, flags); + pmf_device_deregister(self); bus_space_unmap(sc->sc_iobus_bst, sc->sc_iobus_bsh, sc->sc_iobus_size); - return rv; + return 0; } static void |
