HID: sensors: use GFP_ATOMIC under spinlock
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 14 Sep 2012 06:53:23 +0000 (06:53 +0000)
committerJonathan Cameron <jic23@kernel.org>
Tue, 18 Sep 2012 20:50:43 +0000 (21:50 +0100)
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>
drivers/hid/hid-sensor-hub.c

index 4ac759c1fe225c9f9e4d6cf27f9d0f2fd7805ce1..0c93b10b0813c73c96ce0f1fc6f72f96a9563990 100644 (file)
@@ -173,7 +173,7 @@ int sensor_hub_register_callback(struct hid_sensor_hub_device *hsdev,
                        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 @@ 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_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;