From 312d5c9937df3c159b8613fac375cb2c7596b91c Mon Sep 17 00:00:00 2001 From: "jinhyung.jo" Date: Tue, 29 Apr 2014 13:29:19 +0900 Subject: [PATCH] maru_camera: Fixed a bug Fix a bug that emulator is closed unexpectedly when the webcam is not connected to the host PC. Change-Id: I53c7101aa4255666dd8087d4c7034d152ea5745f Signed-off-by: Jinhyung Jo --- tizen/src/hw/maru_camera_common_pci.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tizen/src/hw/maru_camera_common_pci.c b/tizen/src/hw/maru_camera_common_pci.c index 8f892c026e..32191ba399 100644 --- a/tizen/src/hw/maru_camera_common_pci.c +++ b/tizen/src/hw/maru_camera_common_pci.c @@ -270,13 +270,15 @@ static void marucam_resetfn(DeviceState *d) { MaruCamState *s = (MaruCamState *)d; - marucam_device_close(s); - qemu_mutex_lock(&s->thread_mutex); - s->isr = s->streamon = s->req_frame = s->buf_size = 0; - qemu_mutex_unlock(&s->thread_mutex); - memset(s->vaddr, 0, MARUCAM_MEM_SIZE); - memset(s->param, 0x00, sizeof(MaruCamParam)); - INFO("[%s]\n", __func__); + if (s->initialized) { + marucam_device_close(s); + qemu_mutex_lock(&s->thread_mutex); + s->isr = s->streamon = s->req_frame = s->buf_size = 0; + qemu_mutex_unlock(&s->thread_mutex); + memset(s->vaddr, 0, MARUCAM_MEM_SIZE); + memset(s->param, 0x00, sizeof(MaruCamParam)); + TRACE("[%s] This device has been reset\n", __func__); + } } int maru_camera_pci_init(PCIBus *bus) -- 2.34.1