Commit fe23b6bb authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Jiri Kosina

HID: nintendo: check the return value of alloc_workqueue()

The function alloc_workqueue() in nintendo_hid_probe() can fail, but
there is no check of its return value. To fix this bug, its return value
should be checked with new error handling code.

Fixes: c4eae84f ("HID: nintendo: add rumble support")
Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Reviewed-by: default avatarSilvan Jegen <s.jegen@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent cc71d37f
......@@ -2128,6 +2128,10 @@ static int nintendo_hid_probe(struct hid_device *hdev,
spin_lock_init(&ctlr->lock);
ctlr->rumble_queue = alloc_workqueue("hid-nintendo-rumble_wq",
WQ_FREEZABLE | WQ_MEM_RECLAIM, 0);
if (!ctlr->rumble_queue) {
ret = -ENOMEM;
goto err;
}
INIT_WORK(&ctlr->rumble_worker, joycon_rumble_worker);
ret = hid_parse(hdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment