Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: cs40l50 - fix wrong usage of INIT_WORK()

In cs40l50_add(), the work_data is a local variable and the work_data.work
should initialize with INIT_WORK_ONSTACK() instead of INIT_WORK().
Small error in cs40l50_erase() also fixed in this commit.

Fixes: c38fe1bb5d21 ("Input: cs40l50 - Add support for the CS40L50 haptic driver")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Reviewed-by: James Ogletree <jogletre@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20241106013549.78142-1-yuancan@huawei.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Yuan Can and committed by
Dmitry Torokhov
5c822c0c 071b24b5

+4 -2
+4 -2
drivers/input/misc/cs40l50-vibra.c
··· 334 334 work_data.custom_len = effect->u.periodic.custom_len; 335 335 work_data.vib = vib; 336 336 work_data.effect = effect; 337 - INIT_WORK(&work_data.work, cs40l50_add_worker); 337 + INIT_WORK_ONSTACK(&work_data.work, cs40l50_add_worker); 338 338 339 339 /* Push to the workqueue to serialize with playbacks */ 340 340 queue_work(vib->vib_wq, &work_data.work); 341 341 flush_work(&work_data.work); 342 + destroy_work_on_stack(&work_data.work); 342 343 343 344 kfree(work_data.custom_data); 344 345 ··· 468 467 work_data.vib = vib; 469 468 work_data.effect = &dev->ff->effects[effect_id]; 470 469 471 - INIT_WORK(&work_data.work, cs40l50_erase_worker); 470 + INIT_WORK_ONSTACK(&work_data.work, cs40l50_erase_worker); 472 471 473 472 /* Push to workqueue to serialize with playbacks */ 474 473 queue_work(vib->vib_wq, &work_data.work); 475 474 flush_work(&work_data.work); 475 + destroy_work_on_stack(&work_data.work); 476 476 477 477 return work_data.error; 478 478 }