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 2785f1c5fd
commit 9fdacb0960

View File

@@ -462,7 +462,8 @@ 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));
pthread_join(ctx->thread, NULL); if (ctx->thread)
pthread_join(ctx->thread, NULL);
} }
if (ctx->cec_fd > 0) if (ctx->cec_fd > 0)