drivers/video: Fix crash caused by priv->capture_cb = null

When the upper layer calls goldfish_camera_data_uninit, priv->capture_cb=NULL, but when there is data transmission in goldfish_camera_thread, priv->capture_cb will be called, which will cause a crash.

Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
This commit is contained in:
yangsen5 2023-09-12 09:57:59 +08:00 committed by Xiang Xiao
parent f6681218f4
commit e0873c5a48

View File

@ -464,6 +464,11 @@ reload:
DEBUGASSERT(ret == priv->buf_size); DEBUGASSERT(ret == priv->buf_size);
if (priv->capture_cb == NULL)
{
return 0;
}
clock_systime_timespec(&ts); clock_systime_timespec(&ts);
TIMESPEC_TO_TIMEVAL(&tv, &ts); TIMESPEC_TO_TIMEVAL(&tv, &ts);
priv->capture_cb(0, priv->buf_size, &tv, priv->capture_arg); priv->capture_cb(0, priv->buf_size, &tv, priv->capture_arg);