mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
mei: vsc-tp: initialize IRQ state before requesting interrupt
request_threaded_irq() enables the interrupt before returning, so the
threaded handler may schedule work while the probe is still initializing
its mutexes and work item. Initialize that state first and only free the
IRQ on paths where the request succeeded.
Fixes: 566f5ca976 ("mei: Add transport driver for IVSC device")
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
Link: https://patch.msgid.link/20260929132245.2152433-1-runyu.xiao@seu.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
8c8dcfd43c
commit
7754a29246
|
|
@ -496,30 +496,30 @@ static int vsc_tp_probe(struct spi_device *spi)
|
|||
init_waitqueue_head(&tp->xfer_wait);
|
||||
tp->spi = spi;
|
||||
|
||||
mutex_init(&tp->mutex);
|
||||
mutex_init(&tp->event_notify_mutex);
|
||||
INIT_WORK(&tp->event_work, vsc_tp_event_work);
|
||||
|
||||
irq_set_status_flags(spi->irq, IRQ_DISABLE_UNLAZY);
|
||||
ret = request_threaded_irq(spi->irq, NULL, vsc_tp_isr,
|
||||
IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
|
||||
dev_name(dev), tp);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
mutex_init(&tp->mutex);
|
||||
mutex_init(&tp->event_notify_mutex);
|
||||
INIT_WORK(&tp->event_work, vsc_tp_event_work);
|
||||
goto err_destroy_lock;
|
||||
|
||||
/* only one child acpi device */
|
||||
ret = acpi_dev_for_each_child(ACPI_COMPANION(dev),
|
||||
vsc_tp_match_any, &adev);
|
||||
if (!ret) {
|
||||
ret = -ENODEV;
|
||||
goto err_destroy_lock;
|
||||
goto err_free_irq;
|
||||
}
|
||||
|
||||
pinfo.fwnode = acpi_fwnode_handle(adev);
|
||||
pdev = platform_device_register_full(&pinfo);
|
||||
if (IS_ERR(pdev)) {
|
||||
ret = PTR_ERR(pdev);
|
||||
goto err_destroy_lock;
|
||||
goto err_free_irq;
|
||||
}
|
||||
|
||||
tp->pdev = pdev;
|
||||
|
|
@ -527,9 +527,10 @@ static int vsc_tp_probe(struct spi_device *spi)
|
|||
|
||||
return 0;
|
||||
|
||||
err_destroy_lock:
|
||||
err_free_irq:
|
||||
free_irq(spi->irq, tp);
|
||||
|
||||
err_destroy_lock:
|
||||
cancel_work_sync(&tp->event_work);
|
||||
mutex_destroy(&tp->event_notify_mutex);
|
||||
mutex_destroy(&tp->mutex);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user