]> git.baikalelectronics.ru Git - kernel.git/commit
media: cec-pin.c: don't zero work_pin_num_events in adap_enable
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 10 May 2022 11:59:48 +0000 (13:59 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 13 May 2022 09:27:47 +0000 (11:27 +0200)
commit6219c6f4fb320a95a6637443750afb156b8640c5
treee71e3acf0c948f6a9105b69d5df6c7b5eae96d6b
parentd6171ea39308eb8aa7ed9892e8209ac576287f3e
media: cec-pin.c: don't zero work_pin_num_events in adap_enable

It's OK to keep the pending pin events when disabling or
enabling the 'adapter'. Zeroing this can cause a race condition
if this happens when the pin kthread is handling a pin event
and calls atomic_dec later, causing work_pin_num_events to become
negative.

Just leave pending events in the queue, they'll be read eventually.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/cec/core/cec-pin.c