If the programming of the dev_number fails due to an IO error, a new device_number will be assigned, resulting in a leak. Make sure we only assign a device_number once per Slave device.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -546,7 +546,8 @@ struct sdw_slave_ops { · 545 unmodified lines | ||
| 546 | 546 | * @debugfs: Slave debugfs |
| 547 | 547 | * @node: node for bus list |
| 548 | 548 | * @port_ready: Port ready completion flag for each Slave port |
| 549 | − * @dev_num: Device Number assigned by Bus | |
| 549 | + * @dev_num: Current Device Number, values can be 0 or dev_num_sticky | |
| 550 | + * @dev_num_sticky: one-time static Device Number assigned by Bus | |
| 550 | 551 | * @probed: boolean tracking driver state |
| 551 | 552 | * @probe_complete: completion utility to control potential races |
| 552 | 553 | * on startup between driver probe/initialization and SoundWire |
| @@ -575,6 +576,7 @@ struct sdw_slave { · 22 unmodified lines | ||
| 575 | 576 | struct list_head node; |
| 576 | 577 | struct completion *port_ready; |
| 577 | 578 | u16 dev_num; |
| 579 | + u16 dev_num_sticky; | |
| 578 | 580 | bool probed; |
| 579 | 581 | struct completion probe_complete; |
| 580 | 582 | struct completion enumeration_complete; |