From aba0f83e8dca0f2d3cde01e361bceb1459b360db Mon Sep 17 00:00:00 2001 From: Munkyu Im Date: Thu, 17 Apr 2014 15:35:29 +0900 Subject: [PATCH] evdi,nfc: add checking if initialized It returns false if device is not initialized. Change-Id: I1e96d6ebb9e14b11217232c129598767394ffd5e Signed-off-by: Munkyu Im (cherry picked from commit f48ac4136b3603f392ac2489afe5687440d371a0) --- tizen/src/hw/maru_virtio_evdi.c | 6 +++++- tizen/src/hw/maru_virtio_nfc.c | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tizen/src/hw/maru_virtio_evdi.c b/tizen/src/hw/maru_virtio_evdi.c index 2158be3aca..71da1b2ca1 100644 --- a/tizen/src/hw/maru_virtio_evdi.c +++ b/tizen/src/hw/maru_virtio_evdi.c @@ -50,7 +50,6 @@ enum { VirtIOEVDI* vio_evdi; - // typedef struct MsgInfo @@ -83,6 +82,11 @@ bool send_to_evdi(const uint32_t route, char* data, const uint32_t len) int count = 0; char* readptr = data; + if(vio_evdi == NULL) { + ERR("EVDI is not initialized\n"); + return false; + } + if (unlikely(!virtio_queue_ready(vio_evdi->rvq))) { ERR("virtio queue is not ready\n"); return false; diff --git a/tizen/src/hw/maru_virtio_nfc.c b/tizen/src/hw/maru_virtio_nfc.c index 6ad90a516a..3b9d29cae3 100644 --- a/tizen/src/hw/maru_virtio_nfc.c +++ b/tizen/src/hw/maru_virtio_nfc.c @@ -67,6 +67,11 @@ static pthread_mutex_t recv_buf_mutex = PTHREAD_MUTEX_INITIALIZER; bool send_to_nfc(unsigned char id, unsigned char type, const char* data, const uint32_t len) { + if(vio_nfc == NULL) { + ERR("NFC is not initialized\n"); + return false; + } + if (unlikely(!virtio_queue_ready(vio_nfc->rvq))) { ERR("virtio queue is not ready\n"); return false; -- 2.34.1