evdi,nfc: add checking if initialized 11/20011/1
authorMunkyu Im <munkyu.im@samsung.com>
Thu, 17 Apr 2014 06:35:29 +0000 (15:35 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 24 Apr 2014 12:10:10 +0000 (05:10 -0700)
It returns false if device is not initialized.

Change-Id: I1e96d6ebb9e14b11217232c129598767394ffd5e
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
(cherry picked from commit f48ac4136b3603f392ac2489afe5687440d371a0)

tizen/src/hw/maru_virtio_evdi.c
tizen/src/hw/maru_virtio_nfc.c

index 2158be3acad2b747b927fe0caf05de39499bb7c8..71da1b2ca1374dea41f1a96638c9d6bfe8f02f52 100644 (file)
@@ -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;
index 6ad90a516a2ac9aa658b4bad510668c59c8f140a..3b9d29cae3edca23aacb0680097d45391241d3f2 100644 (file)
@@ -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;