diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2013-08-14 11:07:11 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-09-04 12:19:13 +0200 |
commit | 7b0692f1c60a9551f8ad5fe706b79a23720a196c (patch) | |
tree | 54d194c4b13eb79494a252ffb432804a52452271 /drivers/hid | |
parent | 905cc1991aa839fc4c9030f505966ab34637379a (diff) | |
download | kernel_goldelico_gta04-7b0692f1c60a9551f8ad5fe706b79a23720a196c.zip kernel_goldelico_gta04-7b0692f1c60a9551f8ad5fe706b79a23720a196c.tar.gz kernel_goldelico_gta04-7b0692f1c60a9551f8ad5fe706b79a23720a196c.tar.bz2 |
HID: hid-sensor-hub: change kmalloc + memcpy by kmemdup
The patch substitutes kmemdup for kmalloc followed by memcpy.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-sensor-hub.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 1877a25..e46e013 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); } |