evdi,nfc: add checking if initialized 32/19732/1
authorMunkyu Im <munkyu.im@samsung.com>
Thu, 17 Apr 2014 06:35:29 +0000 (15:35 +0900)
committerMunkyu Im <munkyu.im@samsung.com>
Thu, 17 Apr 2014 06:35:29 +0000 (15:35 +0900)
It returns false if device is not initialized.

Change-Id: I1e96d6ebb9e14b11217232c129598767394ffd5e
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
tizen/src/hw/maru_virtio_evdi.c
tizen/src/hw/maru_virtio_nfc.c

index ad2da18..3bf039a 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 08c9a64..22ed170 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;