HID: sensors: use GFP_ATOMIC under spinlock
We're holding a spinlock here so we can't call kmalloc() with
GFP_KERNEL.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 4ac759c..0c93b10 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -173,7 +173,7 @@
spin_unlock(&pdata->dyn_callback_lock);
return -EINVAL;
}
- callback = kzalloc(sizeof(*callback), GFP_KERNEL);
+ callback = kzalloc(sizeof(*callback), GFP_ATOMIC);
if (!callback) {
spin_unlock(&pdata->dyn_callback_lock);
return -ENOMEM;
@@ -462,7 +462,7 @@
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_KERNEL);
+ pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC);
if (pdata->pending.raw_data) {
memcpy(pdata->pending.raw_data, ptr, sz);
pdata->pending.raw_size = sz;