aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2010-08-30 17:54:17 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-09-01 11:15:24 -0400
commit34860089c9e8abcc77428d29743b37ff756197e7 (patch)
treec52ff089b36289ee4792d850acf0af9eb246b135 /drivers/spi/spi.c
parent4e4438b86527e8bf1f49503a30d487e401e64f9c (diff)
spi: free children in spi_unregister_master, not siblings
introduced by 49dce689 ("spi doesn't need class_device") and bad-fixed by 350d0076 ("spi: fix double-free on spi_unregister_master"), spi_unregister_master would previously device_unregister all of the spi master's siblings (instead of its children). hilarity ensues. fix it to unregister children. Signed-off-by: David Lamparter <equinox@diac24.net> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a9e5c79ae52a..0bcf4c1601a2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -554,11 +554,9 @@ done:
554EXPORT_SYMBOL_GPL(spi_register_master); 554EXPORT_SYMBOL_GPL(spi_register_master);
555 555
556 556
557static int __unregister(struct device *dev, void *master_dev) 557static int __unregister(struct device *dev, void *null)
558{ 558{
559 /* note: before about 2.6.14-rc1 this would corrupt memory: */ 559 spi_unregister_device(to_spi_device(dev));
560 if (dev != master_dev)
561 spi_unregister_device(to_spi_device(dev));
562 return 0; 560 return 0;
563} 561}
564 562
@@ -576,8 +574,7 @@ void spi_unregister_master(struct spi_master *master)
576{ 574{
577 int dummy; 575 int dummy;
578 576
579 dummy = device_for_each_child(master->dev.parent, &master->dev, 577 dummy = device_for_each_child(&master->dev, NULL, __unregister);
580 __unregister);
581 device_unregister(&master->dev); 578 device_unregister(&master->dev);
582} 579}
583EXPORT_SYMBOL_GPL(spi_unregister_master); 580EXPORT_SYMBOL_GPL(spi_unregister_master);