Source-Changes-HG archive

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

[src/trunk]: src/sys zero the i2c_attach_args structure before filling it in.



details:   https://anonhg.NetBSD.org/src/rev/06e8386c4159
branches:  trunk
changeset: 813708:06e8386c4159
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Feb 14 19:54:19 2016 +0000

description:
zero the i2c_attach_args structure before filling it in.
fixes occasional crashes in iic_attach().

diffstat:

 sys/arch/acorn26/ioc/iociic.c              |  3 ++-
 sys/arch/arm/at91/at91twi.c                |  7 ++++---
 sys/arch/arm/iomd/iomdiic.c                |  3 ++-
 sys/arch/arm/nvidia/tegra_i2c.c            |  5 +++--
 sys/arch/arm/rockchip/rockchip_i2c.c       |  8 ++++----
 sys/arch/arm/samsung/exynos_i2c.c          |  6 +++---
 sys/arch/arm/xscale/iopi2c.c               |  5 +++--
 sys/arch/evbarm/armadillo/armadillo9_iic.c |  5 +++--
 sys/arch/evbarm/gumstix/gxiic.c            |  5 +++--
 sys/arch/evbarm/nslu2/nslu2_iic.c          |  3 ++-
 sys/arch/hpcarm/dev/nbpiic.c               |  5 +++--
 sys/arch/i386/pci/viapcib.c                |  5 +++--
 sys/arch/macppc/dev/cuda.c                 |  5 +++--
 sys/arch/macppc/dev/ki2c.c                 |  3 ++-
 sys/arch/macppc/dev/pmu.c                  |  5 +++--
 sys/arch/mips/alchemy/dev/ausmbus_psc.c    |  5 +++--
 sys/arch/zaurus/dev/ziic.c                 |  5 +++--
 sys/dev/ic/pca9564.c                       |  5 +++--
 sys/dev/pci/amdpm_smbus.c                  |  5 +++--
 sys/dev/pci/igma.c                         |  5 +++--
 sys/dev/pci/nfsmb.c                        |  5 +++--
 21 files changed, 61 insertions(+), 42 deletions(-)

diffs (truncated from 518 to 300 lines):

diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/acorn26/ioc/iociic.c
--- a/sys/arch/acorn26/ioc/iociic.c     Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/acorn26/ioc/iociic.c     Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iociic.c,v 1.9 2011/07/19 16:05:10 dyoung Exp $        */
+/*     $NetBSD: iociic.c,v 1.10 2016/02/14 19:54:19 chs Exp $  */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -145,6 +145,7 @@
        sc->sc_i2c.ic_read_byte = iociic_read_byte;
        sc->sc_i2c.ic_write_byte = iociic_write_byte;
 
+       memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_i2c;
        (void) config_found_ia(self, "i2cbus", &iba, iicbus_print);
 }
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/arm/at91/at91twi.c
--- a/sys/arch/arm/at91/at91twi.c       Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/arm/at91/at91twi.c       Sun Feb 14 19:54:19 2016 +0000
@@ -1,5 +1,5 @@
-/*     $Id: at91twi.c,v 1.6 2012/10/27 17:17:36 chs Exp $      */
-/*     $NetBSD: at91twi.c,v 1.6 2012/10/27 17:17:36 chs Exp $  */
+/*     $Id: at91twi.c,v 1.7 2016/02/14 19:54:20 chs Exp $      */
+/*     $NetBSD: at91twi.c,v 1.7 2016/02/14 19:54:20 chs Exp $  */
 
 /*-
  * Copyright (c) 2007 Embedtronics Oy. All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91twi.c,v 1.6 2012/10/27 17:17:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91twi.c,v 1.7 2016/02/14 19:54:20 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -134,6 +134,7 @@
        sc->sc_i2c.ic_write_byte = NULL;
        sc->sc_i2c.ic_exec = at91twi_i2c_exec;
 
+       memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_i2c;
        (void) config_found_ia(sc->sc_dev, "i2cbus", &iba, iicbus_print);
 }
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/arm/iomd/iomdiic.c
--- a/sys/arch/arm/iomd/iomdiic.c       Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/arm/iomd/iomdiic.c       Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iomdiic.c,v 1.7 2012/05/14 10:38:08 skrll Exp $        */
+/*     $NetBSD: iomdiic.c,v 1.8 2016/02/14 19:54:20 chs Exp $  */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -147,6 +147,7 @@
        sc->sc_i2c.ic_read_byte = iomdiic_read_byte;
        sc->sc_i2c.ic_write_byte = iomdiic_write_byte;
 
+       memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_i2c;
        (void) config_found_ia(sc->sc_dev, "i2cbus", &iba, iicbus_print);
 }
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/arm/nvidia/tegra_i2c.c
--- a/sys/arch/arm/nvidia/tegra_i2c.c   Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/arm/nvidia/tegra_i2c.c   Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_i2c.c,v 1.12 2015/12/22 22:12:08 jmcneill Exp $ */
+/* $NetBSD: tegra_i2c.c,v 1.13 2016/02/14 19:54:20 chs Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_i2c.c,v 1.12 2015/12/22 22:12:08 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_i2c.c,v 1.13 2016/02/14 19:54:20 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -191,6 +191,7 @@
 
        of_enter_i2c_devs(devs, faa->faa_phandle, address_cells * 4, 0);
 
+       memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_ic;
        iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
        if (iba.iba_child_devices != NULL) {
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/arm/rockchip/rockchip_i2c.c
--- a/sys/arch/arm/rockchip/rockchip_i2c.c      Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/arm/rockchip/rockchip_i2c.c      Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rockchip_i2c.c,v 1.6 2015/01/11 14:59:13 jmcneill Exp $ */
+/* $NetBSD: rockchip_i2c.c,v 1.7 2016/02/14 19:54:20 chs Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
 #include "opt_rkiic.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rockchip_i2c.c,v 1.6 2015/01/11 14:59:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rockchip_i2c.c,v 1.7 2016/02/14 19:54:20 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -142,9 +142,9 @@
        sc->sc_ic.ic_release_bus = rkiic_release_bus;
        sc->sc_ic.ic_exec = rkiic_exec;
 
+       memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_ic;
-       sc->sc_i2cdev = config_found_ia(self, "i2cbus",
-           &iba, iicbus_print);
+       sc->sc_i2cdev = config_found_ia(self, "i2cbus", &iba, iicbus_print);
 }
 
 static int
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/arm/samsung/exynos_i2c.c
--- a/sys/arch/arm/samsung/exynos_i2c.c Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/arm/samsung/exynos_i2c.c Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exynos_i2c.c,v 1.10 2016/01/01 22:37:07 marty Exp $ */
+/*     $NetBSD: exynos_i2c.c,v 1.11 2016/02/14 19:54:20 chs Exp $ */
 
 /*
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
 #include "opt_arm_debug.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.10 2016/01/01 22:37:07 marty Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.11 2016/02/14 19:54:20 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -187,8 +187,8 @@
        sc->sc_ic.ic_read_byte   = exynos_i2c_read_byte;
        sc->sc_ic.ic_write_byte  = exynos_i2c_write_byte;
 
+       memset(&iba, 0, sizeof(iba));
        sc->sc_i2cdev = config_found_ia(self, "i2cbus", &iba, iicbus_print);
-
 }
 
 static i2c_tag_t
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/arm/xscale/iopi2c.c
--- a/sys/arch/arm/xscale/iopi2c.c      Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/arm/xscale/iopi2c.c      Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iopi2c.c,v 1.7 2012/01/10 18:55:37 jakllsch Exp $      */
+/*     $NetBSD: iopi2c.c,v 1.8 2016/02/14 19:54:20 chs Exp $   */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iopi2c.c,v 1.7 2012/01/10 18:55:37 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iopi2c.c,v 1.8 2016/02/14 19:54:20 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/mutex.h>
@@ -79,6 +79,7 @@
        sc->sc_i2c.ic_read_byte = iopiic_read_byte;
        sc->sc_i2c.ic_write_byte = iopiic_write_byte;
 
+       memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_i2c;
        (void) config_found_ia(sc->sc_dev, "i2cbus", &iba, iicbus_print);
 }
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/evbarm/armadillo/armadillo9_iic.c
--- a/sys/arch/evbarm/armadillo/armadillo9_iic.c        Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/evbarm/armadillo/armadillo9_iic.c        Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: armadillo9_iic.c,v 1.7 2012/10/27 17:17:46 chs Exp $   */
+/*     $NetBSD: armadillo9_iic.c,v 1.8 2016/02/14 19:54:20 chs Exp $   */
 
 /*
  * Copyright (c) 2005 HAMAJIMA Katsuomi. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: armadillo9_iic.c,v 1.7 2012/10/27 17:17:46 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: armadillo9_iic.c,v 1.8 2016/02/14 19:54:20 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -115,6 +115,7 @@
        sc->sc_i2c.ic_read_byte = armadillo9iic_read_byte;
        sc->sc_i2c.ic_write_byte = armadillo9iic_write_byte;
 
+       memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_i2c;
 
        epgpio_in(sc->sc_gpio, sc->sc_port, sc->sc_sda);
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/evbarm/gumstix/gxiic.c
--- a/sys/arch/evbarm/gumstix/gxiic.c   Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/evbarm/gumstix/gxiic.c   Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gxiic.c,v 1.7 2011/06/21 11:38:03 kiyohara Exp $ */
+/*     $NetBSD: gxiic.c,v 1.8 2016/02/14 19:54:20 chs Exp $ */
 /*
  * Copyright (c) 2007 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gxiic.c,v 1.7 2011/06/21 11:38:03 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gxiic.c,v 1.8 2016/02/14 19:54:20 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -109,6 +109,7 @@
        sc->sc_i2c.ic_write_byte = NULL;
        sc->sc_i2c.ic_exec = gxiic_exec;
 
+       memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_i2c;
        pxa2x0_i2c_open(&sc->sc_pxa_i2c);
        config_found_ia(sc->sc_pxa_i2c.sc_dev, "i2cbus", &iba, iicbus_print);
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/evbarm/nslu2/nslu2_iic.c
--- a/sys/arch/evbarm/nslu2/nslu2_iic.c Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/evbarm/nslu2/nslu2_iic.c Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nslu2_iic.c,v 1.8 2012/10/14 14:20:58 msaitoh Exp $    */
+/*     $NetBSD: nslu2_iic.c,v 1.9 2016/02/14 19:54:20 chs Exp $        */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -210,6 +210,7 @@
        reg |= GPIO_I2C_SDA_BIT;
        GPIO_CONF_WRITE_4(ixp425_softc, IXP425_GPIO_GPOER, reg);
 
+       memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_ic;
        (void) config_found_ia(self, "i2cbus", &iba, iicbus_print);
 }
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/hpcarm/dev/nbpiic.c
--- a/sys/arch/hpcarm/dev/nbpiic.c      Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/hpcarm/dev/nbpiic.c      Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nbpiic.c,v 1.1 2011/08/06 03:53:40 kiyohara Exp $ */
+/*     $NetBSD: nbpiic.c,v 1.2 2016/02/14 19:54:20 chs Exp $ */
 /*
  * Copyright (c) 2011 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nbpiic.c,v 1.1 2011/08/06 03:53:40 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nbpiic.c,v 1.2 2016/02/14 19:54:20 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -130,6 +130,7 @@
        sc->sc_i2c.ic_write_byte = NULL;
        sc->sc_i2c.ic_exec = nbpiic_exec;
 
+       memset(&iba, 0, sizeof(iba));
        iba.iba_tag = &sc->sc_i2c;
        pxa2x0_i2c_open(&sc->sc_pxa_i2c);
        config_found_ia(self, "i2cbus", &iba, iicbus_print);
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/i386/pci/viapcib.c
--- a/sys/arch/i386/pci/viapcib.c       Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/i386/pci/viapcib.c       Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: viapcib.c,v 1.14 2011/07/05 07:08:17 mrg Exp $ */
+/* $NetBSD: viapcib.c,v 1.15 2016/02/14 19:54:20 chs Exp $ */
 /* $FreeBSD: src/sys/pci/viapm.c,v 1.10 2005/05/29 04:42:29 nyan Exp $ */
 
 /*-
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: viapcib.c,v 1.14 2011/07/05 07:08:17 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viapcib.c,v 1.15 2016/02/14 19:54:20 chs Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -215,6 +215,7 @@
                viapcib_smbus_write(sc, SMBSLVCNT, b & ~1);
 
                memset(&sc->sc_i2c, 0, sizeof(sc->sc_i2c));
+               memset(&iba, 0, sizeof(iba));
 #ifdef I2C_TYPE_SMBUS
                iba.iba_type = I2C_TYPE_SMBUS;
 #endif
diff -r 4794706df3a1 -r 06e8386c4159 sys/arch/macppc/dev/cuda.c
--- a/sys/arch/macppc/dev/cuda.c        Sun Feb 14 19:11:19 2016 +0000
+++ b/sys/arch/macppc/dev/cuda.c        Sun Feb 14 19:54:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cuda.c,v 1.20 2014/08/13 10:56:35 macallan Exp $ */
+/*     $NetBSD: cuda.c,v 1.21 2016/02/14 19:54:20 chs Exp $ */
 



Home | Main Index | Thread Index | Old Index