mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drivers: gpu: drm: i915: Replaced calls to kmalloc & memcpy with kmemdup
@ 2013-03-11 20:39 Alexandru Gheorghiu
  2013-03-11 21:19 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandru Gheorghiu @ 2013-03-11 20:39 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: David Airlie, dri-devel, linux-kernel, Alexandru Gheorghiu

Replaced calls to kmalloc followed by memcpy with a single call to kmemdup.
Also removed a now redundant if statement.

Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
---
 drivers/gpu/drm/i915/intel_dp.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f61cb79..3cf8aed 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2335,11 +2335,8 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
 			return NULL;
 
 		size = (intel_connector->edid->extensions + 1) * EDID_LENGTH;
-		edid = kmalloc(size, GFP_KERNEL);
-		if (!edid)
-			return NULL;
+		edid = kmemdup(intel_connector->edid, size, GFP_KERNEL);
 
-		memcpy(edid, intel_connector->edid, size);
 		return edid;
 	}
 
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH] drivers: gpu: drm: i915: Replaced calls to kmalloc & memcpy with kmemdup
@ 2013-03-11 19:30 Alexandru Gheorghiu
  2013-03-11 20:25 ` Josh Triplett
  0 siblings, 1 reply; 4+ messages in thread
From: Alexandru Gheorghiu @ 2013-03-11 19:30 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: David Airlie, dri-devel, linux-kernel, Alexandru Gheorghiu

Replaced calls to kmalloc followed by memcpy with a single call to kmemdup.
This patch was found using coccinelle.

Signed-off-by: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
---
 drivers/gpu/drm/i915/intel_dp.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f61cb79..a3fdd65 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2335,11 +2335,10 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
 			return NULL;
 
 		size = (intel_connector->edid->extensions + 1) * EDID_LENGTH;
-		edid = kmalloc(size, GFP_KERNEL);
+		edid = kmemdup(intel_connector->edid, size, GFP_KERNEL);
 		if (!edid)
 			return NULL;
 
-		memcpy(edid, intel_connector->edid, size);
 		return edid;
 	}
 
-- 
1.7.9.5


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

end of thread, other threads:[~2013-03-11 21:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-11 20:39 [PATCH] drivers: gpu: drm: i915: Replaced calls to kmalloc & memcpy with kmemdup Alexandru Gheorghiu
2013-03-11 21:19 ` Joe Perches
  -- strict thread matches above, loose matches on Subject: below --
2013-03-11 19:30 Alexandru Gheorghiu
2013-03-11 20:25 ` Josh Triplett

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®