remove build warning
authorlokilee73 <changjoo.lee@samsung.com>
Fri, 8 Sep 2017 07:03:04 +0000 (16:03 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Mon, 11 Sep 2017 22:33:11 +0000 (22:33 +0000)
Touchscreen_init calls the open function of hal at the begining of the boot with the call stack below.
So, the open function of hal is never called at the same time in multi-thread.

Therefore, we can use safely readdir in deviced.

0  touchscreen_init
1  0x2a00b02c in devices_init (data=0x0) at /usr/src/debug/deviced-2.0.0/src/core/devices.c:102
2  0x2a00e424 in deviced_main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/deviced-2.0.0/src/core/main.c:93
3  0x2a0078f4 in main (argc=1, argv=0xbefffe64) at /usr/src/debug/deviced-2.0.0/src/core/main.c:123

Change-Id: Iee6fcde249df15a73723d7ae1ffce7c68c93b9ad
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
(cherry picked from commit 042bfd00d4596e55e59ff8d7d1ab1896b07ee91a)

hw/touchscreen/touchscreen.c
hw/usb_client/usb_client.c [changed mode: 0644->0755]

index 39ad64f..b9e2e12 100644 (file)
@@ -40,7 +40,6 @@ static char *touchscreen_node;
 static int touchscreen_probe(void)
 {
        DIR *d;
-       struct dirent entry;
        struct dirent *dir;
        char buf[PATH_MAX];
        int val, ret = -ENOTSUP;
@@ -49,7 +48,7 @@ static int touchscreen_probe(void)
        if (!d)
                return -ENOTSUP;
 
-       while (readdir_r(d, &entry, &dir) == 0 && dir != NULL) {
+       while ((dir = readdir(d))) {
                if (dir->d_name[0] == '.')
                        continue;
                snprintf(buf, sizeof(buf), "%s%s%s", INPUT_PATH,
old mode 100644 (file)
new mode 100755 (executable)
index 455e741..232381b
@@ -565,7 +565,7 @@ static void legacy_free_gadget(struct usb_gadget *gadget)
        if (!gadget)
                return;
 
-               if (gadget->strs) {
+       if (gadget->strs) {
                for (i = 0; gadget->strs[i].lang_code; ++i) {
                        free(gadget->strs[i].manufacturer);
                        free(gadget->strs[i].product);