From: Greg KH <greg@kroah.com>
To: khali@linux-fr.org, kraxel@bytesex.org
Cc: linux-kernel@vger.kernel.org, stable@kernel.org
Subject: [01/11] fix amd64 2.6.11 oops on modprobe (saa7110)
Date: Thu, 10 Mar 2005 15:07:53 -0800 [thread overview]
Message-ID: <20050310230753.GB22112@kroah.com> (raw)
In-Reply-To: <20050310230519.GA22112@kroah.com>
-stable review patch. If anyone has any objections, please let us know.
------------------
This is a rewrite of the saa7110_write_block function, which was plain
broken in the case where the underlying adapter supports I2C_FUNC_I2C.
It also includes related fixes which ensure that different parts of the
driver agree on the number of registers the chip has.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Chris Wright <chrisw@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- linux-2.6.11-bk3/drivers/media/video/saa7110.c.orig Tue Mar 8 10:27:15 2005
+++ linux-2.6.11-bk3/drivers/media/video/saa7110.c Tue Mar 8 12:02:45 2005
@@ -58,10 +58,12 @@
#define SAA7110_MAX_INPUT 9 /* 6 CVBS, 3 SVHS */
#define SAA7110_MAX_OUTPUT 0 /* its a decoder only */
-#define I2C_SAA7110 0x9C /* or 0x9E */
+#define I2C_SAA7110 0x9C /* or 0x9E */
+
+#define SAA7110_NR_REG 0x35
struct saa7110 {
- unsigned char reg[54];
+ u8 reg[SAA7110_NR_REG];
int norm;
int input;
@@ -95,31 +97,28 @@
unsigned int len)
{
int ret = -1;
- u8 reg = *data++;
+ u8 reg = *data; /* first register to write to */
- len--;
+ /* Sanity check */
+ if (reg + (len - 1) > SAA7110_NR_REG)
+ return ret;
/* the saa7110 has an autoincrement function, use it if
* the adapter understands raw I2C */
if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
struct saa7110 *decoder = i2c_get_clientdata(client);
struct i2c_msg msg;
- u8 block_data[54];
- msg.len = 0;
- msg.buf = (char *) block_data;
+ msg.len = len;
+ msg.buf = (char *) data;
msg.addr = client->addr;
- msg.flags = client->flags;
- while (len >= 1) {
- msg.len = 0;
- block_data[msg.len++] = reg;
- while (len-- >= 1 && msg.len < 54)
- block_data[msg.len++] =
- decoder->reg[reg++] = *data++;
- ret = i2c_transfer(client->adapter, &msg, 1);
- }
+ msg.flags = 0;
+ ret = i2c_transfer(client->adapter, &msg, 1);
+
+ /* Cache the written data */
+ memcpy(decoder->reg + reg, data + 1, len - 1);
} else {
- while (len-- >= 1) {
+ for (++data, --len; len; len--) {
if ((ret = saa7110_write(client, reg++,
*data++)) < 0)
break;
@@ -192,7 +191,7 @@
return 0;
}
-static const unsigned char initseq[] = {
+static const unsigned char initseq[1 + SAA7110_NR_REG] = {
0, 0x4C, 0x3C, 0x0D, 0xEF, 0xBD, 0xF2, 0x03, 0x00,
/* 0x08 */ 0xF8, 0xF8, 0x60, 0x60, 0x00, 0x86, 0x18, 0x90,
/* 0x10 */ 0x00, 0x59, 0x40, 0x46, 0x42, 0x1A, 0xFF, 0xDA,
next prev parent reply other threads:[~2005-03-10 23:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-10 23:05 [00/11] -stable review Greg KH
2005-03-10 23:07 ` Greg KH [this message]
2005-03-11 1:37 ` [01/11] fix amd64 2.6.11 oops on modprobe (saa7110) Josh Boyer
2005-03-11 7:57 ` Greg KH
2005-03-11 9:13 ` Jean Delvare
2005-03-11 16:39 ` [stable] " Chris Wright
2005-03-10 23:08 ` [02/11] cramfs: small stat(2) fix Greg KH
2005-03-10 23:08 ` [03/11] drm missing memset can crash X server Greg KH
2005-03-10 23:08 ` [04/11] ppc32: Compilation fixes for Ebony, Luan and Ocotea Greg KH
2005-03-10 23:08 ` [05/11] Fix i2c messsage flags in video drivers Greg KH
2005-03-10 23:08 ` [06/11] [TCP]: Put back tcp_timer_bug_msg[] symbol export Greg KH
2005-03-10 23:20 ` Christoph Hellwig
2005-03-10 23:47 ` David S. Miller
2005-03-10 23:08 ` [07/11] ppc32: trivial fix for e500 oprofile build Greg KH
2005-03-10 23:09 ` [08/11] PCI-E: fix hotplug double free Greg KH
2005-03-10 23:09 ` [09/11] r8169: receive descriptor length fix Greg KH
2005-03-10 23:09 ` [10/11] sis900 kernel oops fix Greg KH
2005-03-10 23:09 ` [11/11] [VIA RHINE] older chips oops on shutdown Greg KH
2005-03-10 23:15 ` [stable] [00/11] -stable review Chris Wright
2005-03-10 23:18 ` Greg KH
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=20050310230753.GB22112@kroah.com \
--to=greg@kroah.com \
--cc=khali@linux-fr.org \
--cc=kraxel@bytesex.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox