Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips mips: Use config_detach_children to reduce err...
details: https://anonhg.NetBSD.org/src/rev/1d5d49d6ede0
branches: trunk
changeset: 374685:1d5d49d6ede0
user: riastradh <riastradh%NetBSD.org@localhost>
date: Wed May 10 00:07:58 2023 +0000
description:
mips: Use config_detach_children to reduce error branch bugs.
diffstat:
sys/arch/mips/ralink/ralink_cfi.c | 15 ++++++++-------
sys/arch/mips/rmi/rmixl_nand.c | 15 ++++++++-------
2 files changed, 16 insertions(+), 14 deletions(-)
diffs (80 lines):
diff -r 2bac686d82dc -r 1d5d49d6ede0 sys/arch/mips/ralink/ralink_cfi.c
--- a/sys/arch/mips/ralink/ralink_cfi.c Wed May 10 00:07:49 2023 +0000
+++ b/sys/arch/mips/ralink/ralink_cfi.c Wed May 10 00:07:58 2023 +0000
@@ -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;
+
+ error = config_detach_children(self, flags);
+ if (error)
+ return error;
pmf_device_deregister(self);
- if (sc->sc_nordev != NULL)
- rv = config_detach(sc->sc_nordev, flags);
-
bus_space_unmap(sc->sc_cfi.cfi_bst, sc->sc_cfi.cfi_bsh, sc->sc_size);
- return rv;
+ return 0;
}
diff -r 2bac686d82dc -r 1d5d49d6ede0 sys/arch/mips/rmi/rmixl_nand.c
--- a/sys/arch/mips/rmi/rmixl_nand.c Wed May 10 00:07:49 2023 +0000
+++ b/sys/arch/mips/rmi/rmixl_nand.c Wed May 10 00:07:58 2023 +0000
@@ -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;
+
+ error = config_detach_children(self, flags);
+ if (error)
+ return error;
pmf_device_deregister(self);
- if (sc->sc_nanddev != NULL)
- rv = config_detach(sc->sc_nanddev, flags);
-
bus_space_unmap(sc->sc_iobus_bst, sc->sc_iobus_bsh, sc->sc_iobus_size);
- return rv;
+ return 0;
}
static void
Home |
Main Index |
Thread Index |
Old Index