mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexandru Gheorghiu <gheorghiuandru@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Alexandru Gheorghiu <gheorghiuandru@gmail.com>
Subject: [PATCH] drivers: gpu: drm: i915: Replaced calls to kmalloc & memcpy with kmemdup
Date: Mon, 11 Mar 2013 22:39:42 +0200	[thread overview]
Message-ID: <1363034382-22752-1-git-send-email-gheorghiuandru@gmail.com> (raw)

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


             reply	other threads:[~2013-03-11 20:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-11 20:39 Alexandru Gheorghiu [this message]
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

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=1363034382-22752-1-git-send-email-gheorghiuandru@gmail.com \
    --to=gheorghiuandru@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@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 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®