All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
To: dbrownell@users.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] [2.6.18] Correct bus_num and buffer bug in spi core
Date: Thu, 19 Oct 2006 11:17:43 +0200	[thread overview]
Message-ID: <453742B7.5080200@atmel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

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

[-- Attachment #2: spi-fix-spi-busnum-to-master-buffer-and-bus_num-0.patch --]
[-- Type: text/x-patch, Size: 778 bytes --]

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

                 reply	other threads:[~2006-10-19  9:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=453742B7.5080200@atmel.com \
    --to=hcegtvedt@atmel.com \
    --cc=dbrownell@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.