From 9fdacb096031b093b016592de2bc1d9fdded2a49 Mon Sep 17 00:00:00 2001 From: Oleg Lyovin Date: Tue, 17 Sep 2024 15:31:30 +0300 Subject: [PATCH] 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 --- cec/hdmi_cec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cec/hdmi_cec.c b/cec/hdmi_cec.c index bb9a1ba..ee2c125 100644 --- a/cec/hdmi_cec.c +++ b/cec/hdmi_cec.c @@ -462,7 +462,8 @@ static int hdmicec_close(struct hdmi_cec_device *dev) if (ctx->exit_fd > 0) { 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)