LKML Archive on
help / color / mirror / Atom feed
From: Julia Lawall <>
To: Sujeev Dias <>
Cc: Greg Kroah-Hartman <>,
	Arnd Bergmann <>, Sujeev Dias <>,,,
	Tony Truong <>,
Subject: [PATCH] mhi_bus: core: fix memdup.cocci warnings
Date: Sat, 28 Apr 2018 09:23:19 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1804280922250.2700@hadrien> (raw)

From: Fengguang Wu <>

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: ec8245f7a36f ("mhi_bus: core: Add support for MHI host interface")
CC: Sujeev Dias <>
Signed-off-by: Fengguang Wu <>
Signed-off-by: Julia Lawall <>

:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago

 mhi_boot.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/bus/mhi/core/mhi_boot.c
+++ b/drivers/bus/mhi/core/mhi_boot.c
@@ -504,7 +504,7 @@ void mhi_fw_load_worker(struct work_stru
 	if (size > firmware->size)
 		size = firmware->size;

-	buf = kmalloc(size, GFP_KERNEL);
+	buf = kmemdup(firmware->data, size, GFP_KERNEL);
 	if (!buf) {
 		MHI_ERR("Could not allocate memory for image\n");
@@ -512,7 +512,6 @@ void mhi_fw_load_worker(struct work_stru

 	/* load sbl image */
-	memcpy(buf, firmware->data, size);
 	ret = mhi_fw_load_sbl(mhi_cntrl, buf, size);

                 reply	other threads:[~2018-04-28  7:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1804280922250.2700@hadrien \ \ \ \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).