dibs->lock is initialised by dibs_dev_add(), but a dibs device can already take interrupts before that call: ism_probe() runs ism_dev_init(), and hence request_irq(), before it calls dibs_dev_add(). No client can have registered a dmb at that point, so no dmb interrupt can occur, but a GID event interrupt can, and ism_handle_irq() takes dibs->lock unconditionally on entry, before it inspects anything else. Initialise the lock in dibs_dev_alloc() instead, so that it is valid as soon as a driver can publish the device to its interrupt handler.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -439,7 +439,7 @@ static inline void *dibs_get_priv(struct dibs_dev *dev, · 438 unmodified lines | |||
| 439 | /** | 439 | /** |
| 440 | * dibs_dev_alloc() - allocate and reference device structure | 440 | * dibs_dev_alloc() - allocate and reference device structure |
| 441 | * | 441 | * |
| 442 | * The following fields will be valid upon successful return: dev | 442 | * The following fields will be valid upon successful return: dev, lock |
| 443 | * NOTE: Use put_device(dibs_get_dev(@dibs)) to give up your reference instead | 443 | * NOTE: Use put_device(dibs_get_dev(@dibs)) to give up your reference instead |
| 444 | * of freeing @dibs @dev directly once you have successfully called this | 444 | * of freeing @dibs @dev directly once you have successfully called this |
| 445 | * function. | 445 | * function. |