spi/of: Fix initialization of cs_gpios array
authorAndreas Larsson <andreas@gaisler.com>
Tue, 29 Jan 2013 14:53:40 +0000 (15:53 +0100)
committerGrant Likely <grant.likely@secretlab.ca>
Sun, 10 Feb 2013 23:59:55 +0000 (23:59 +0000)
Using memset does not set an array of integers properly. Replace with a
loop to set each element properly.

Signed-off-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
drivers/spi/spi.c

index d1e0a316826d99ed2e69c89eac11de641c3f0685..6707cb2f4fa40243c424507ad7ab44d17e3dc628 100644 (file)
@@ -1080,7 +1080,8 @@ static int of_spi_register_master(struct spi_master *master)
        if (!master->cs_gpios)
                return -ENOMEM;
 
-       memset(cs, -EINVAL, master->num_chipselect);
+       for (i = 0; i < master->num_chipselect; i++)
+               cs[i] = -EINVAL;
 
        for (i = 0; i < nb; i++)
                cs[i] = of_get_named_gpio(np, "cs-gpios", i);
This page took 0.025908 seconds and 5 git commands to generate.