Skip to content

Commit

Permalink
spi/of: Fix initialization of cs_gpios array
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andreas Larsson authored and Grant Likely committed Feb 10, 2013
1 parent 0d73299 commit 0da83bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/spi/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0da83bb

Please sign in to comment.