From: Eric Sesterhenn <snakebyte@gmx.de>
To: kernel-janitors@vger.kernel.org
Subject: [KJ] [Patch] kmemdup() cleanup in drivers/video/
Date: Thu, 26 Oct 2006 19:07:07 +0000 [thread overview]
Message-ID: <1161889627.7318.9.camel@alice> (raw)
In-Reply-To: <1161634468.419.1.camel@alice>
hi,
replace open coded kmemdup() to save some screen space,
and allow inlining/not inlining to be triggered by gcc.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.19-rc3-git1/drivers/video/aty/radeon_monitor.c.orig 2006-10-26 20:02:44.000000000 +0200
+++ linux-2.6.19-rc3-git1/drivers/video/aty/radeon_monitor.c 2006-10-26 20:03:05.000000000 +0200
@@ -104,10 +104,9 @@ static int __devinit radeon_parse_montyp
if (pedid = NULL)
return mt;
- tmp = (u8 *)kmalloc(EDID_LENGTH, GFP_KERNEL);
+ tmp = kmemdup(pedid, EDID_LENGTH, GFP_KERNEL);
if (!tmp)
return mt;
- memcpy(tmp, pedid, EDID_LENGTH);
*out_EDID = tmp;
return mt;
}
--- linux-2.6.19-rc3-git1/drivers/video/i810/i810-i2c.c.orig 2006-10-26 20:03:36.000000000 +0200
+++ linux-2.6.19-rc3-git1/drivers/video/i810/i810-i2c.c 2006-10-26 20:03:55.000000000 +0200
@@ -162,9 +162,7 @@ int i810_probe_i2c_connector(struct fb_i
if (e != NULL) {
DPRINTK("i810-i2c: Getting EDID from BIOS\n");
- edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
- if (edid)
- memcpy(edid, e, EDID_LENGTH);
+ edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
}
}
--- linux-2.6.19-rc3-git1/drivers/video/intelfb/intelfbdrv.c.orig 2006-10-26 20:04:22.000000000 +0200
+++ linux-2.6.19-rc3-git1/drivers/video/intelfb/intelfbdrv.c 2006-10-26 20:04:47.000000000 +0200
@@ -1058,10 +1058,9 @@ intelfb_init_var(struct intelfb_info *di
u8 *edid_d = NULL;
if (edid_s) {
- edid_d = kmalloc(EDID_LENGTH, GFP_KERNEL);
+ edid_d = kmemdup(edid_s, EDID_LENGTH, GFP_KERNEL);
if (edid_d) {
- memcpy(edid_d, edid_s, EDID_LENGTH);
fb_edid_to_monspecs(edid_d,
&dinfo->info->monspecs);
kfree(edid_d);
--- linux-2.6.19-rc3-git1/drivers/video/nvidia/nv_i2c.c.orig 2006-10-26 20:05:17.000000000 +0200
+++ linux-2.6.19-rc3-git1/drivers/video/nvidia/nv_i2c.c 2006-10-26 20:05:30.000000000 +0200
@@ -210,11 +210,8 @@ int nvidia_probe_i2c_connector(struct fb
/* try to get from firmware */
const u8 *e = fb_firmware_edid(info->device);
- if (e != NULL) {
- edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
- if (edid)
- memcpy(edid, e, EDID_LENGTH);
- }
+ if (e != NULL)
+ edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
}
*out_edid = edid;
--- linux-2.6.19-rc3-git1/drivers/video/nvidia/nv_of.c.orig 2006-10-26 20:05:55.000000000 +0200
+++ linux-2.6.19-rc3-git1/drivers/video/nvidia/nv_of.c 2006-10-26 20:06:16.000000000 +0200
@@ -72,10 +72,9 @@ int nvidia_probe_of_connector(struct fb_
}
}
if (pedid) {
- *out_edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
+ *out_edid = kmemdup(pedid, EDID_LENGTH, GFP_KERNEL);
if (*out_edid = NULL)
return -1;
- memcpy(*out_edid, pedid, EDID_LENGTH);
printk(KERN_DEBUG "nvidiafb: Found OF EDID for head %d\n", conn);
return 0;
}
--- linux-2.6.19-rc3-git1/drivers/video/savage/savagefb-i2c.c.orig 2006-10-26 20:06:53.000000000 +0200
+++ linux-2.6.19-rc3-git1/drivers/video/savage/savagefb-i2c.c 2006-10-26 20:07:13.000000000 +0200
@@ -227,11 +227,8 @@ int savagefb_probe_i2c_connector(struct
/* try to get from firmware */
const u8 *e = fb_firmware_edid(info->device);
- if (e) {
- edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
- if (edid)
- memcpy(edid, e, EDID_LENGTH);
- }
+ if (e)
+ edid = kmemdup(e, EDID_LENGTH, GFP_KERNEL);
}
*out_edid = edid;
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2006-10-26 19:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-23 20:14 [KJ] [Patch] kmemdup() cleanup in drivers/acpi/ Eric Sesterhenn
2006-10-23 20:15 ` [KJ] [Patch] kmemdup() cleanup in drivers/base Eric Sesterhenn
2006-10-23 20:16 ` [KJ] [Patch] kmemdup() cleanup in drivers/ieee1394 Eric Sesterhenn
2006-10-23 20:17 ` [KJ] [Patch] kmemdup() cleanup in drivers/infiniband Eric Sesterhenn
2006-10-23 20:18 ` [KJ] [Patch] kmemdup() cleanup in drivers/media/video Eric Sesterhenn
2006-10-23 20:19 ` [KJ] [Patch] kmemdup() cleanup in drivers/message Eric Sesterhenn
2006-10-23 20:20 ` [KJ] [Patch] kmemdup() cleanup in drivers/net Eric Sesterhenn
2006-10-23 20:21 ` [KJ] [Patch] kmemdup() cleanup in drivers/parport Eric Sesterhenn
2006-10-23 20:22 ` [KJ] [Patch] kmemdup() cleanup in drivers/pci/ Eric Sesterhenn
2006-10-23 20:42 ` [KJ] [Patch] kmemdup() cleanup in drivers/message Matthew Wilcox
2006-10-24 3:05 ` [KJ] [Patch] kmemdup() cleanup in drivers/infiniband Roland Dreier
2006-10-24 8:26 ` [KJ] [Patch] kmemdup() cleanup in drivers/pci/ Alexey Dobriyan
2006-10-24 14:53 ` Eric Sesterhenn / Snakebyte
2006-10-24 16:36 ` walter harms
2006-10-24 17:51 ` Alexey Dobriyan
2006-10-24 18:09 ` Matthew Wilcox
2006-10-26 19:04 ` [KJ] [Patch] kmemdup() cleanup in drivers/scsi Eric Sesterhenn
2006-10-26 19:07 ` Eric Sesterhenn [this message]
2006-10-29 19:00 ` [KJ] [Patch] kmemdup() cleanup in drivers/media/video Alexey Dobriyan
2006-10-29 19:02 ` [KJ] [Patch] kmemdup() cleanup in drivers/message Alexey Dobriyan
2006-11-06 8:13 ` [KJ] [Patch] kmemdup() cleanup in drivers/net Jeff Garzik
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=1161889627.7318.9.camel@alice \
--to=snakebyte@gmx.de \
--cc=kernel-janitors@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.