Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/fdt dwiic(4): Don't try to attach children if dwiic_...



details:   https://anonhg.NetBSD.org/src/rev/5a0b8690a3b2
branches:  trunk
changeset: 371948:5a0b8690a3b2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Oct 19 22:28:35 2022 +0000

description:
dwiic(4): Don't try to attach children if dwiic_attach failed.

PR kern/57063

diffstat:

 sys/arch/x86/pci/dwiic_pci.c |  7 ++++---
 sys/dev/acpi/dwiic_acpi.c    |  7 ++++---
 sys/dev/fdt/dwiic_fdt.c      |  7 ++++---
 3 files changed, 12 insertions(+), 9 deletions(-)

diffs (84 lines):

diff -r d3ccf327a771 -r 5a0b8690a3b2 sys/arch/x86/pci/dwiic_pci.c
--- a/sys/arch/x86/pci/dwiic_pci.c      Wed Oct 19 21:28:02 2022 +0000
+++ b/sys/arch/x86/pci/dwiic_pci.c      Wed Oct 19 22:28:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwiic_pci.c,v 1.8 2021/10/27 19:04:03 msaitoh Exp $ */
+/* $NetBSD: dwiic_pci.c,v 1.9 2022/10/19 22:28:35 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwiic_pci.c,v 1.8 2021/10/27 19:04:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwiic_pci.c,v 1.9 2022/10/19 22:28:35 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -277,7 +277,8 @@
                aprint_verbose_dev(self, "no matching ACPI node\n");
        }
 
-       dwiic_attach(&sc->sc_dwiic);
+       if (!dwiic_attach(&sc->sc_dwiic))
+               goto out;
 
        config_found(self, &sc->sc_dwiic.sc_iba, iicbus_print, CFARGS_NONE);
 
diff -r d3ccf327a771 -r 5a0b8690a3b2 sys/dev/acpi/dwiic_acpi.c
--- a/sys/dev/acpi/dwiic_acpi.c Wed Oct 19 21:28:02 2022 +0000
+++ b/sys/dev/acpi/dwiic_acpi.c Wed Oct 19 22:28:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwiic_acpi.c,v 1.9 2021/08/07 16:19:09 thorpej Exp $ */
+/* $NetBSD: dwiic_acpi.c,v 1.10 2022/10/19 22:28:35 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwiic_acpi.c,v 1.9 2021/08/07 16:19:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwiic_acpi.c,v 1.10 2022/10/19 22:28:35 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -127,7 +127,8 @@
 
        sc->sc_iba.iba_child_devices = acpi_enter_i2c_devs(self, aa->aa_node);
 
-       dwiic_attach(sc);
+       if (!dwiic_attach(sc))
+               goto done;
 
        config_found(self, &sc->sc_iba, iicbus_print, CFARGS_NONE);
 
diff -r d3ccf327a771 -r 5a0b8690a3b2 sys/dev/fdt/dwiic_fdt.c
--- a/sys/dev/fdt/dwiic_fdt.c   Wed Oct 19 21:28:02 2022 +0000
+++ b/sys/dev/fdt/dwiic_fdt.c   Wed Oct 19 22:28:35 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwiic_fdt.c,v 1.4 2021/01/27 03:10:21 thorpej Exp $ */
+/* $NetBSD: dwiic_fdt.c,v 1.5 2022/10/19 22:28:35 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwiic_fdt.c,v 1.4 2021/01/27 03:10:21 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwiic_fdt.c,v 1.5 2022/10/19 22:28:35 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -105,7 +105,8 @@
                goto out;
        }
 
-       dwiic_attach(&sc->sc_dwiic);
+       if (!dwiic_attach(&sc->sc_dwiic))
+               goto out;
 
        pmf_device_register(self, dwiic_suspend, dwiic_resume);
 



Home | Main Index | Thread Index | Old Index