mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gma500: Use kmemdup rather than duplicating its implementation
@ 2011-11-12 12:15 Thomas Meyer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Meyer @ 2011-11-12 12:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, linux-kernel

Use kmemdup rather than duplicating its implementation

The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/staging/gma500/intel_bios.c b/drivers/staging/gma500/intel_bios.c
--- a/drivers/staging/gma500/intel_bios.c 2011-11-07 19:38:10.703630794 +0100
+++ b/drivers/staging/gma500/intel_bios.c 2011-11-08 10:52:10.090491565 +0100
@@ -104,12 +104,11 @@ static void parse_backlight_data(struct
 	bl_start = find_section(bdb, BDB_LVDS_BACKLIGHT);
 	vbt_lvds_bl = (struct bdb_lvds_backlight *)(bl_start + 1) + p_type;
 
-	lvds_bl = kzalloc(sizeof(*vbt_lvds_bl), GFP_KERNEL);
+	lvds_bl = kmemdup(vbt_lvds_bl, sizeof(*vbt_lvds_bl), GFP_KERNEL);
 	if (!lvds_bl) {
 		dev_err(dev_priv->dev->dev, "out of memory for backlight data\n");
 		return;
 	}
-	memcpy(lvds_bl, vbt_lvds_bl, sizeof(*vbt_lvds_bl));
 	dev_priv->lvds_bl = lvds_bl;
 }
 



^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH] gma500: Use kmemdup rather than duplicating its implementation
@ 2011-11-12 17:02 Thomas Meyer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Meyer @ 2011-11-12 17:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, linux-kernel

Use kmemdup rather than duplicating its implementation

The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---

diff -u -p a/drivers/staging/gma500/intel_bios.c b/drivers/staging/gma500/intel_bios.c
--- a/drivers/staging/gma500/intel_bios.c 2011-11-07 19:38:10.703630794 +0100
+++ b/drivers/staging/gma500/intel_bios.c 2011-11-08 10:52:10.090491565 +0100
@@ -104,12 +104,11 @@ static void parse_backlight_data(struct
 	bl_start = find_section(bdb, BDB_LVDS_BACKLIGHT);
 	vbt_lvds_bl = (struct bdb_lvds_backlight *)(bl_start + 1) + p_type;
 
-	lvds_bl = kzalloc(sizeof(*vbt_lvds_bl), GFP_KERNEL);
+	lvds_bl = kmemdup(vbt_lvds_bl, sizeof(*vbt_lvds_bl), GFP_KERNEL);
 	if (!lvds_bl) {
 		dev_err(dev_priv->dev->dev, "out of memory for backlight data\n");
 		return;
 	}
-	memcpy(lvds_bl, vbt_lvds_bl, sizeof(*vbt_lvds_bl));
 	dev_priv->lvds_bl = lvds_bl;
 }
 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-12 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-12 12:15 [PATCH] gma500: Use kmemdup rather than duplicating its implementation Thomas Meyer
2011-11-12 17:02 Thomas Meyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®