aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans-Christian Egtvedt <hcegtvedt@atmel.com>2006-12-06 23:36:17 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:32 -0500
commit4740d387f3cb9e63f48f2488815b38a2c92755c8 (patch)
treebc4da709250cfe0b18a5d5dc040e5af3ed57e94d
parented2908f31398049c4371de9b100700e80704e95f (diff)
[PATCH] spi: correct bus_num and buffer bug in spi core
Correct the following in driver/spi/spi.c in function spi_busnum_to_master: * must allow bus_num 0, the if is really not needed. * correct the name buffer which is too small for bus_num >= 10000. It should be 9 bytes big, not 8. Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/spi/spi.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 1a3c963dc48a..7d215eaa1370 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -465,15 +465,13 @@ EXPORT_SYMBOL_GPL(spi_unregister_master);
465 */ 465 */
466struct spi_master *spi_busnum_to_master(u16 bus_num) 466struct spi_master *spi_busnum_to_master(u16 bus_num)
467{ 467{
468 if (bus_num) { 468 char name[9];
469 char name[8]; 469 struct kobject *bus;
470 struct kobject *bus; 470
471 471 snprintf(name, sizeof name, "spi%u", bus_num);
472 snprintf(name, sizeof name, "spi%u", bus_num); 472 bus = kset_find_obj(&spi_master_class.subsys.kset, name);
473 bus = kset_find_obj(&spi_master_class.subsys.kset, name); 473 if (bus)
474 if (bus) 474 return container_of(bus, struct spi_master, cdev.kobj);
475 return container_of(bus, struct spi_master, cdev.kobj);
476 }
477 return NULL; 475 return NULL;
478} 476}
479EXPORT_SYMBOL_GPL(spi_busnum_to_master); 477EXPORT_SYMBOL_GPL(spi_busnum_to_master);