From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jiri Kosina <jkosina@suse.cz>,
linux-input@vger.kernel.org,
Srinivas Pandruvada <srinivas.pandruvada@intel.com>
Subject: Re: [PATCH 4/4] hid-sensor-hub: change kmalloc + memcpy by kmemdup
Date: Mon, 19 Aug 2013 08:32:22 -0700 [thread overview]
Message-ID: <52123A86.4030509@linux.intel.com> (raw)
In-Reply-To: <1376467631-20857-4-git-send-email-andriy.shevchenko@linux.intel.com>
On 08/14/2013 01:07 AM, Andy Shevchenko wrote:
> The patch substitutes kmemdup for kmalloc followed by memcpy.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/hid/hid-sensor-hub.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
> index 4cb19df..0794e9f 100644
> --- a/drivers/hid/hid-sensor-hub.c
> +++ b/drivers/hid/hid-sensor-hub.c
> @@ -430,11 +430,10 @@ static int sensor_hub_raw_event(struct hid_device *hdev,
> if (pdata->pending.status && pdata->pending.attr_usage_id ==
> report->field[i]->usage->hid) {
> hid_dbg(hdev, "data was pending ...\n");
> - pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC);
> - if (pdata->pending.raw_data) {
> - memcpy(pdata->pending.raw_data, ptr, sz);
> + pdata->pending.raw_data = kmemdup(ptr, sz, GFP_ATOMIC);
> + if (pdata->pending.raw_data)
> pdata->pending.raw_size = sz;
> - } else
> + else
> pdata->pending.raw_size = 0;
> complete(&pdata->pending.ready);
> }
Agreed.
Thanks,
Srinivas
next prev parent reply other threads:[~2013-08-19 15:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 8:07 [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko
2013-08-14 8:07 ` [PATCH 2/4] hid-sensor-hub: fix indentation accross the code Andy Shevchenko
2013-08-19 15:28 ` Srinivas Pandruvada
2013-08-29 14:53 ` Andy Shevchenko
2013-09-04 10:21 ` Jiri Kosina
2013-08-14 8:07 ` [PATCH 3/4] hid-sensor-hub: move to devm_kzalloc Andy Shevchenko
2013-08-19 15:31 ` Srinivas Pandruvada
2013-08-14 8:07 ` [PATCH 4/4] hid-sensor-hub: change kmalloc + memcpy by kmemdup Andy Shevchenko
2013-08-19 15:32 ` Srinivas Pandruvada [this message]
2013-08-19 8:48 ` [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko
2013-08-19 15:26 ` Srinivas Pandruvada
2013-08-26 11:46 ` Jiri Kosina
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=52123A86.4030509@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=srinivas.pandruvada@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).