Remove equal to distinguish pass or failure more stricktly
[platform/core/system/system-popup.git] / src / usb / usbotg-mobile.c
old mode 100755 (executable)
new mode 100644 (file)
index d83bba5..6c70b67
@@ -107,7 +107,7 @@ static void launch_app(int type)
 {
        app_control_h app_control;
 
-       int ret, i, type_len;
+       int ret = -1, i, type_len;
 
        type_len = ARRAY_SIZE(app_type);
        for (i = 0 ; i < ARRAY_SIZE(app_type) ; i++) {
@@ -115,7 +115,7 @@ static void launch_app(int type)
                        break;
        }
        if (i == type_len) {
-               _E("Invalid type (%d)", type);
+               _E("Invalid type(%d).", type);
                return;
        }
 
@@ -128,20 +128,24 @@ static void launch_app(int type)
        else if (type == 1)
                ret = app_control_set_app_id(app_control, GALLERY_APPNAME);
        else {
-               _E("No matched type(%d)", type);
-               return;
+               _E("No matched type(%d).", type);
+               goto out;
        }
 
        if (ret != APP_CONTROL_ERROR_NONE) {
-               (void)app_control_destroy(app_control);
-               return;
+               _E("Failed to set app id.");
+               goto out;
        }
 
        ret = app_control_send_launch_request(app_control, NULL, NULL);
        if (ret != APP_CONTROL_ERROR_NONE)
-               _E("Failed to send launch request");
+               _E("Fail to send launch request.");
 
-       (void)app_control_destroy(app_control);
+out:
+       if (app_control) {
+               (void)app_control_destroy(app_control);
+               app_control = NULL;
+       }
 }
 
 static void storage_browse(const struct popup_ops *ops)
@@ -171,7 +175,7 @@ static void storage_unmount(const struct popup_ops *ops)
                        DEVICED_IFACE_USBHOST,
                        SIGNAL_NAME_UNMOUNT, "s", param);
        if (ret < 0)
-               _E("FAIL: broadcast_dbus_signal()");
+               _E("Failed to broadcast_dbus_signal().");
 
        memset(removed_path, 0, sizeof(removed_path));
 
@@ -187,11 +191,11 @@ static int storage_mounted_launch(bundle *b, const struct popup_ops *ops)
 
        path = (char *)bundle_get_val(b, USB_MOUNT_PATH);
        if (!path) {
-               _E("Failed to get mount path");
+               _E("Failed to get mount path.");
                return -2;
        }
 
-       _I("USB storage mount path (%s)", path);
+       _I("USB storage mount path(%s).", path);
        snprintf(added_path, sizeof(added_path), "%s", path);
        return 0;
 }
@@ -205,7 +209,7 @@ static int unmount_storage_launch(bundle *b, const struct popup_ops *ops)
 
        path = (char *)bundle_get_val(b, USB_MOUNT_PATH);
        if (!path) {
-               _E("Failed to get mount path");
+               _E("Failed to get mount path.");
                return -2;
        }
 
@@ -224,7 +228,7 @@ static int storage_unmounted(bundle *b, const struct popup_ops *ops)
 
        path = (char *)bundle_get_val(b, USB_MOUNT_PATH);
        if (!path) {
-               _E("Failed to get mount path");
+               _E("Failed to get mount path.");
                return -ENOENT;
        }