NetBSD-Bugs archive

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

Re: port-arm/53171: Broadcom (and other ARM SoC i2c drivers) mis-handle indirect configuration of devices



Here is a more complete patch.  That NULL assignment is redundant, of course, and this catches the rest of the ARM SoC drivers that get it wrong.

Index: broadcom/bcm2835_bsc.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/broadcom/bcm2835_bsc.c,v
retrieving revision 1.10
diff -u -p -r1.10 bcm2835_bsc.c
--- broadcom/bcm2835_bsc.c      3 Mar 2018 16:03:38 -0000       1.10
+++ broadcom/bcm2835_bsc.c      13 Apr 2018 03:35:18 -0000
@@ -183,8 +183,6 @@ bsciic_attach(device_t parent, device_t 
        iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
        if (iba.iba_child_devices)
                prop_object_retain(iba.iba_child_devices);
-       else
-               iba.iba_child_devices = prop_array_create();
        prop_object_release(devs);
 
        config_found_ia(self, "i2cbus", &iba, iicbus_print);
Index: nvidia/tegra_i2c.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/nvidia/tegra_i2c.c,v
retrieving revision 1.16
diff -u -p -r1.16 tegra_i2c.c
--- nvidia/tegra_i2c.c  25 May 2017 23:43:49 -0000      1.16
+++ nvidia/tegra_i2c.c  13 Apr 2018 03:35:18 -0000
@@ -199,11 +199,8 @@ tegra_i2c_attach(device_t parent, device
        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) {
+       if (iba.iba_child_devices != NULL)
                prop_object_retain(iba.iba_child_devices);
-       } else {
-               iba.iba_child_devices = prop_array_create();
-       }
        prop_object_release(devs);
 
        sc->sc_i2cdev = config_found_ia(self, "i2cbus", &iba, iicbus_print);
Index: samsung/exynos_i2c.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/samsung/exynos_i2c.c,v
retrieving revision 1.13
diff -u -p -r1.13 exynos_i2c.c
--- samsung/exynos_i2c.c        2 Jul 2017 18:27:45 -0000       1.13
+++ samsung/exynos_i2c.c        13 Apr 2018 03:35:18 -0000
@@ -198,8 +198,6 @@ exynos_i2c_attach(device_t parent, devic
        iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
        if (iba.iba_child_devices != NULL)
                prop_object_retain(iba.iba_child_devices);
-       else
-               iba.iba_child_devices = prop_array_create();
        prop_object_release(devs);
 
        sc->sc_i2cdev = config_found_ia(self, "i2cbus", &iba, iicbus_print);
Index: sunxi/sunxi_rsb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/sunxi/sunxi_rsb.c,v
retrieving revision 1.1
diff -u -p -r1.1 sunxi_rsb.c
--- sunxi/sunxi_rsb.c   2 Jul 2017 18:06:45 -0000       1.1
+++ sunxi/sunxi_rsb.c   13 Apr 2018 03:35:18 -0000
@@ -220,8 +220,6 @@ sunxi_rsb_attach(device_t parent, device
        iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
        if (iba.iba_child_devices)
                prop_object_retain(iba.iba_child_devices);
-       else
-               iba.iba_child_devices = prop_array_create();
        prop_object_release(devs);
 
        sc->sc_i2cdev = config_found_ia(self, "i2cbus", &iba, iicbus_print);
Index: sunxi/sunxi_twi.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/sunxi/sunxi_twi.c,v
retrieving revision 1.8
diff -u -p -r1.8 sunxi_twi.c
--- sunxi/sunxi_twi.c   2 Dec 2017 18:56:18 -0000       1.8
+++ sunxi/sunxi_twi.c   13 Apr 2018 03:35:18 -0000
@@ -236,8 +236,6 @@ sunxi_twi_attach(device_t parent, device
        iba.iba_child_devices = prop_dictionary_get(devs, "i2c-child-devices");
        if (iba.iba_child_devices)
                prop_object_retain(iba.iba_child_devices);
-       else
-               iba.iba_child_devices = prop_array_create();
        prop_object_release(devs);
 
        config_found_ia(self, "i2cbus", &iba, iicbus_print);



Home | Main Index | Thread Index | Old Index