Browse Source

spi/of: Fix initialization of cs_gpios array

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>
Andreas Larsson 12 years ago
parent
commit
0da83bb1c9
1 changed files with 2 additions and 1 deletions
  1. 2 1
      drivers/spi/spi.c

+ 2 - 1
drivers/spi/spi.c

@@ -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);