Commit bfba7b37 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds

[PATCH] drivers/video/*: use kmemdup()

From: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent efc08a75
...@@ -104,10 +104,9 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_ ...@@ -104,10 +104,9 @@ static int __devinit radeon_parse_montype_prop(struct device_node *dp, u8 **out_
if (pedid == NULL) if (pedid == NULL)
return mt; return mt;
tmp = (u8 *)kmalloc(EDID_LENGTH, GFP_KERNEL); tmp = kmemdup(pedid, EDID_LENGTH, GFP_KERNEL);
if (!tmp) if (!tmp)
return mt; return mt;
memcpy(tmp, pedid, EDID_LENGTH);
*out_EDID = tmp; *out_EDID = tmp;
return mt; return mt;
} }
......
...@@ -162,9 +162,7 @@ int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid, int conn) ...@@ -162,9 +162,7 @@ int i810_probe_i2c_connector(struct fb_info *info, u8 **out_edid, int conn)
if (e != NULL) { if (e != NULL) {
DPRINTK("i810-i2c: Getting EDID from BIOS\n"); DPRINTK("i810-i2c: Getting EDID from BIOS\n");
edid = kmalloc(EDID_LENGTH, GFP_KERNEL); edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
if (edid)
memcpy(edid, e, EDID_LENGTH);
} }
} }
......
...@@ -1058,10 +1058,9 @@ intelfb_init_var(struct intelfb_info *dinfo) ...@@ -1058,10 +1058,9 @@ intelfb_init_var(struct intelfb_info *dinfo)
u8 *edid_d = NULL; u8 *edid_d = NULL;
if (edid_s) { if (edid_s) {
edid_d = kmalloc(EDID_LENGTH, GFP_KERNEL); edid_d = kmemdup(edid_s, EDID_LENGTH, GFP_KERNEL);
if (edid_d) { if (edid_d) {
memcpy(edid_d, edid_s, EDID_LENGTH);
fb_edid_to_monspecs(edid_d, fb_edid_to_monspecs(edid_d,
&dinfo->info->monspecs); &dinfo->info->monspecs);
kfree(edid_d); kfree(edid_d);
......
...@@ -210,11 +210,8 @@ int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid) ...@@ -210,11 +210,8 @@ int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid)
/* try to get from firmware */ /* try to get from firmware */
const u8 *e = fb_firmware_edid(info->device); const u8 *e = fb_firmware_edid(info->device);
if (e != NULL) { if (e != NULL)
edid = kmalloc(EDID_LENGTH, GFP_KERNEL); edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
if (edid)
memcpy(edid, e, EDID_LENGTH);
}
} }
*out_edid = edid; *out_edid = edid;
......
...@@ -72,10 +72,9 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) ...@@ -72,10 +72,9 @@ int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid)
} }
} }
if (pedid) { if (pedid) {
*out_edid = kmalloc(EDID_LENGTH, GFP_KERNEL); *out_edid = kmemdup(pedid, EDID_LENGTH, GFP_KERNEL);
if (*out_edid == NULL) if (*out_edid == NULL)
return -1; return -1;
memcpy(*out_edid, pedid, EDID_LENGTH);
printk(KERN_DEBUG "nvidiafb: Found OF EDID for head %d\n", conn); printk(KERN_DEBUG "nvidiafb: Found OF EDID for head %d\n", conn);
return 0; return 0;
} }
......
...@@ -227,11 +227,8 @@ int savagefb_probe_i2c_connector(struct fb_info *info, u8 **out_edid) ...@@ -227,11 +227,8 @@ int savagefb_probe_i2c_connector(struct fb_info *info, u8 **out_edid)
/* try to get from firmware */ /* try to get from firmware */
const u8 *e = fb_firmware_edid(info->device); const u8 *e = fb_firmware_edid(info->device);
if (e) { if (e)
edid = kmalloc(EDID_LENGTH, GFP_KERNEL); edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
if (edid)
memcpy(edid, e, EDID_LENGTH);
}
} }
*out_edid = edid; *out_edid = edid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment