Skip to content

Commit e3c2d2d

Browse files
kaehndJiri Kosina
authored andcommitted
hid: cp2112: Fix duplicate workqueue initialization
Previously the cp2112 driver called INIT_DELAYED_WORK within cp2112_gpio_irq_startup, resulting in duplicate initilizations of the workqueue on subsequent IRQ startups following an initial request. This resulted in a warning in set_work_data in workqueue.c, as well as a rare NULL dereference within process_one_work in workqueue.c. Initialize the workqueue within _probe instead. Fixes: 13de9cc ("HID: cp2112: add IRQ chip handling") Signed-off-by: Danny Kaehn <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 29aa98d commit e3c2d2d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hid/hid-cp2112.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,8 +1151,6 @@ static unsigned int cp2112_gpio_irq_startup(struct irq_data *d)
11511151
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
11521152
struct cp2112_device *dev = gpiochip_get_data(gc);
11531153

1154-
INIT_DELAYED_WORK(&dev->gpio_poll_worker, cp2112_gpio_poll_callback);
1155-
11561154
if (!dev->gpio_poll) {
11571155
dev->gpio_poll = true;
11581156
schedule_delayed_work(&dev->gpio_poll_worker, 0);
@@ -1307,6 +1305,8 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
13071305
girq->handler = handle_simple_irq;
13081306
girq->threaded = true;
13091307

1308+
INIT_DELAYED_WORK(&dev->gpio_poll_worker, cp2112_gpio_poll_callback);
1309+
13101310
ret = gpiochip_add_data(&dev->gc, dev);
13111311
if (ret < 0) {
13121312
hid_err(hdev, "error registering gpio chip\n");

0 commit comments

Comments
 (0)