lkml.org 
[lkml]   [2006]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] [2.6.18] Correct bus_num and buffer bug in spi core
Hello,

Included is a patch which corrects 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.

Sorry if I should have split the patch in two.

I am not on the linux-kernel list.

Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>

--
With kind regards,

Hans-Christian Egtvedt
Applications Engineer - AVR Applications Lab
--- a/drivers/spi/spi.c 2006-10-19 10:37:26.000000000 +0200
+++ b/drivers/spi/spi.c 2006-10-19 10:38:59.000000000 +0200
@@ -465,15 +465,13 @@ EXPORT_SYMBOL_GPL(spi_unregister_master)
*/
struct spi_master *spi_busnum_to_master(u16 bus_num)
{
- if (bus_num) {
- char name[8];
- struct kobject *bus;
-
- snprintf(name, sizeof name, "spi%u", bus_num);
- bus = kset_find_obj(&spi_master_class.subsys.kset, name);
- if (bus)
- return container_of(bus, struct spi_master, cdev.kobj);
- }
+ char name[9];
+ struct kobject *bus;
+
+ snprintf(name, sizeof name, "spi%u", bus_num);
+ bus = kset_find_obj(&spi_master_class.subsys.kset, name);
+ if (bus)
+ return container_of(bus, struct spi_master, cdev.kobj);
return NULL;
}
EXPORT_SYMBOL_GPL(spi_busnum_to_master);
\
 
 \ /
  Last update: 2006-10-19 11:21    [W:0.039 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site