From b22553e54797c8a766b4400b927a94408db3c690 Mon Sep 17 00:00:00 2001 From: "jinhyung.jo" Date: Fri, 26 Jun 2015 18:46:55 +0900 Subject: [PATCH] maru-camera: Fixed an issue that crash or slow down the emulator Removed access to the garbage value that has not been initialized. Change-Id: Ib71f05656bc59b135fae523f450ae5102e258023 Signed-off-by: Jinhyung Jo --- tizen/src/hw/pci/maru_camera_linux_pci.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tizen/src/hw/pci/maru_camera_linux_pci.c b/tizen/src/hw/pci/maru_camera_linux_pci.c index 406478b838..fc32798eff 100644 --- a/tizen/src/hw/pci/maru_camera_linux_pci.c +++ b/tizen/src/hw/pci/maru_camera_linux_pci.c @@ -80,7 +80,7 @@ static int previous_frame_index = -1; static struct marucam_framebuffer *framebuffer; static const char *dev_name = "/dev/video0"; -static int v4l2_fd; +static int v4l2_fd = -1; static int convert_trial; static int ready_count; static int timeout_n; @@ -818,6 +818,8 @@ int marucam_device_check(int log_flag) void marucam_device_init(MaruCamState *state) { state->destroying = false; + memset(&saved_frame, 0x00, sizeof(saved_frame)); + qemu_thread_create(&state->thread_id, MARUCAM_THREAD_NAME, marucam_worker_thread, @@ -1385,7 +1387,9 @@ void marucam_device_close(MaruCamState *state) } memset(&saved_frame, 0x00, sizeof(saved_frame)); - v4l2_close(v4l2_fd); - v4l2_fd = 0; + if (v4l2_fd >= 0) { + v4l2_close(v4l2_fd); + v4l2_fd = -1; + } INFO("Closed\n"); } -- 2.34.1