On 8/27/24 5:17 PM, Bao D. Nguyen wrote:
On 8/23/2024 1:25 PM, Bart Van Assche wrote:
- if (completion)
- init_completion(&uic_cmd->done);
+ init_completion(&uic_cmd->done);
This change may not work, Bart.
Why not? It is allowed to call init_completion() multiple times before
wait_for_completion() is called. It is even allowed to call
init_completion() without ever calling wait_for_completion(). All
init_completion() does is to perform a few assignments:
static inline void init_completion(struct completion *x)
{
x->done = 0;
init_swait_queue_head(&x->wait);
}
It is not allowed to call init_completion() concurrently with
wait_for_completion() because that would trigger a race condition. But
I don't think that my patch introduces such a race.
Thanks,
Bart.