aboutsummaryrefslogtreecommitdiffstats
path: root/samsung-ipc/ipc.c
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-02-23 11:19:39 +0100
committerPaul Kocialkowski <contact@paulk.fr>2014-02-23 11:19:39 +0100
commit121ae6d21c18dd79ed1dc7df4c86a681d70a337a (patch)
tree2283270e9681cbd589c6f61e0ac28eb2cb9e8d33 /samsung-ipc/ipc.c
parent420519cbbaf40fb2af8295f8eb7a80d281b0933d (diff)
downloadexternal_libsamsung-ipc-121ae6d21c18dd79ed1dc7df4c86a681d70a337a.zip
external_libsamsung-ipc-121ae6d21c18dd79ed1dc7df4c86a681d70a337a.tar.gz
external_libsamsung-ipc-121ae6d21c18dd79ed1dc7df4c86a681d70a337a.tar.bz2
ipc_devices: Proper type for count and index
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc/ipc.c')
-rw-r--r--samsung-ipc/ipc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/samsung-ipc/ipc.c b/samsung-ipc/ipc.c
index a8cacf0..5a5de3e 100644
--- a/samsung-ipc/ipc.c
+++ b/samsung-ipc/ipc.c
@@ -104,7 +104,7 @@ int ipc_device_detect(void)
kernel_version = strdup(utsname.release);
#endif
- for (i = 0; i < ipc_devices_count; i++) {
+ for (i = 0; i < (int) ipc_devices_count; i++) {
// Eliminate index if the name doesn't match
if (name != NULL && ipc_devices[i].name != NULL && strcmp(name, ipc_devices[i].name) != 0)
continue;
@@ -147,13 +147,18 @@ complete:
struct ipc_client *ipc_client_create(int type)
{
struct ipc_client *client = NULL;
- int device_index;
+ unsigned int device_index;
+ int rc;
if (type < 0 || type > IPC_CLIENT_TYPE_RFS)
return NULL;
- device_index = ipc_device_detect();
- if (device_index < 0 || device_index > ipc_devices_count)
+ rc = ipc_device_detect();
+ if (rc < 0)
+ goto error;
+
+ device_index = (unsigned int) rc;
+ if (device_index > ipc_devices_count)
goto error;
client = (struct ipc_client *) calloc(1, sizeof(struct ipc_client));