From: Wei Yongjun <weiyj.lk@gmail.com>
To: Evgeniy Polyakov <zbr@ioremap.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Cc: Wei Yongjun <weiyongjun1@huawei.com>, linux-kernel@vger.kernel.org
Subject: [PATCH -next] w1: ds2490: use kmemdup rather than duplicating its implementation
Date: Thu, 9 Feb 2017 15:45:42 +0000 [thread overview]
Message-ID: <20170209154542.16315-1-weiyj.lk@gmail.com> (raw)
From: Wei Yongjun <weiyongjun1@huawei.com>
Use kmemdup rather than duplicating its implementation.
Generated by: scripts/coccinelle/api/memdup.cocci
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/w1/masters/ds2490.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index 59d74d1..be77b79 100644
--- a/drivers/w1/masters/ds2490.c
+++ b/drivers/w1/masters/ds2490.c
@@ -909,11 +909,10 @@ static void ds9490r_write_block(void *data, const u8 *buf, int len)
if (len <= 0)
return;
- tbuf = kmalloc(len, GFP_KERNEL);
+ tbuf = kmemdup(buf, len, GFP_KERNEL);
if (!tbuf)
return;
- memcpy(tbuf, buf, len);
ds_write_block(dev, tbuf, len);
kfree(tbuf);
next reply other threads:[~2017-02-09 15:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 15:45 Wei Yongjun [this message]
2017-02-10 1:25 ` Maciej S. Szmigiero
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=20170209154542.16315-1-weiyj.lk@gmail.com \
--to=weiyj.lk@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@maciej.szmigiero.name \
--cc=weiyongjun1@huawei.com \
--cc=zbr@ioremap.net \
/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®