summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.osdl.org>2006-11-16 22:18:28 -0800
committerLinus Torvalds <torvalds@woody.osdl.org>2006-11-16 22:18:28 -0800
commit4be703906cffd5902028d20626e636ba21fb0b61 (patch)
tree23c51cca66244b688c10c3330638064377972743
parent4f71c5de19c27f2198105d3b26b398494d5c353b (diff)
Fix generic fb_ddc i2c edid probe msg
Benh points out that the msgs[0].flags entry never got initialized, and since it's an automatic stack allocation, it could have any random value, which is bad. Rewrite the initializer to explicitly initialize all fields of the small i2c_msg structure array we generate. Just to keep it all obvious, let's handle msgs[1].buf in the same initializer while we're at it, instead of initializing that one separately later. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/video/fb_ddc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/video/fb_ddc.c b/drivers/video/fb_ddc.c
index 3aa6ebf68f17..f836137a0eda 100644
--- a/drivers/video/fb_ddc.c
+++ b/drivers/video/fb_ddc.c
@@ -20,26 +20,26 @@
static unsigned char *fb_do_probe_ddc_edid(struct i2c_adapter *adapter)
{
unsigned char start = 0x0;
+ unsigned char *buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
struct i2c_msg msgs[] = {
{
.addr = DDC_ADDR,
+ .flags = 0,
.len = 1,
.buf = &start,
}, {
.addr = DDC_ADDR,
.flags = I2C_M_RD,
.len = EDID_LENGTH,
+ .buf = buf,
}
};
- unsigned char *buf;
- buf = kmalloc(EDID_LENGTH, GFP_KERNEL);
if (!buf) {
dev_warn(&adapter->dev, "unable to allocate memory for EDID "
"block.\n");
return NULL;
}
- msgs[1].buf = buf;
if (i2c_transfer(adapter, msgs, 2) == 2)
return buf;