pmqos: Fix build warning caused by mis-type casting 42/141042/7
authorWook Song <wook16.song@samsung.com>
Fri, 28 Jul 2017 01:23:39 +0000 (10:23 +0900)
committerWook Song <wook16.song@samsung.com>
Fri, 4 Aug 2017 00:15:17 +0000 (09:15 +0900)
This patch fixes a build warning caused by mis-type casting from a
pointer to a int type while building the package for aarch64. On the
32-bit environment, the size of a pointer is 4 bytes which is the same
size of a int type. However, on the other hand, on the 64-bit
environment, the size of a pointer is 8 bytes while the size of a int
type is still 4 bytes. This is the main reason of the build warning.

According to the booting_done_received function in sre/core/boot.c, a
pointer of the int variable, done, is passed as the first argument, a
void pointer, of the notifier call back functions. Therefore, such type
casting from a void pointer to int is unnecssary and seems to be buggy.
This patch modifies it to cast the type from void pointer to int
pointer.

Change-Id: I1dc9932b11a2800c56de23bbdb4a3dd66cee854f
Signed-off-by: Wook Song <wook16.song@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pmqos/pmqos.c

index 9cf9f6dcc93b71f73ebbbb98fb56b0ec4784fb7f..39b63086072288077a6cd9d4e9bb607b56d5788b 100644 (file)
@@ -18,7 +18,6 @@
 
 
 #include <stdio.h>
-#include <stdbool.h>
 #include <limits.h>
 #include <Ecore.h>
 #include <device-node.h>
@@ -65,7 +64,7 @@ static void pmqos_free(void);
 static DBusMessage* e_dbus_start_cb(E_DBus_Object *obj, DBusMessage* msg)
 {
        DBusMessage *ret_dbus = NULL;
-       bool booting_done = true;
+       int booting_done = 1;
        int ret;
 
        ret = pmqos_init_done(&booting_done, NULL);
@@ -375,17 +374,17 @@ static const struct edbus_method edbus_methods[] = {
 static int pmqos_init_done(void *data, void *user_data)
 {
        struct edbus_method *methods = NULL;
-       int booting_done;
+       int *booting_done;
        int ret, size;
 
        /*
         * As a callback function for the booting-done event, it is notified
         * with the result of the booting_finished() function by using the
-        * first argument, void *data. When it is successfully booted up, 1 is
-        * passed with the first argument.
+        * first argument, void *data. When it is successfully booted up, an int
+        * value, 1 is passed with the first argument.
         */
-       booting_done = (int)data;
-       if (!booting_done)
+       booting_done = (int *) data;
+       if (!(*booting_done))
                return -EINVAL;
 
        /* register edbus methods */