CEC: do not join NULL thread

'hdmicec_close' may be called after exit_fd initialized,
but before ctx->thread created.

This patch checks it for NULL before join.

Test: manual
Change-Id: I1c57be56f2cd9956044d9a48fea914b1c1fd0132
Signed-off-by: Oleg Lyovin <ovlevin@salutedevices.com>
This commit is contained in:
Oleg Lyovin
2024-09-17 15:31:30 +03:00
committed by Konsta
parent adc7d7b432
commit 59dbe8e028

View File

@@ -462,6 +462,7 @@ static int hdmicec_close(struct hdmi_cec_device *dev)
if (ctx->exit_fd > 0) { if (ctx->exit_fd > 0) {
write(ctx->exit_fd, &tmp, sizeof(tmp)); write(ctx->exit_fd, &tmp, sizeof(tmp));
if (ctx->thread)
pthread_join(ctx->thread, NULL); pthread_join(ctx->thread, NULL);
} }