Fixed incorrect use of errno in usb cfs client 00/228800/1
authorINSUN PYO <insun.pyo@samsung.com>
Wed, 25 Mar 2020 22:29:34 +0000 (07:29 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Wed, 25 Mar 2020 22:29:34 +0000 (07:29 +0900)
Change-Id: Ib091544138444c4108c7b09eb3e70e830661648e

hw/usb_cfs_client_common.c

index 0a1990b..f03395c 100644 (file)
@@ -187,13 +187,10 @@ static int cfs_set_gadget_strs(struct cfs_client *cfs_client,
 
 static int cfs_ensure_dir(char *path)
 {
-       int ret;
-
-       ret = mkdir(path, 0770);
-       if (ret < 0)
-               ret = errno == EEXIST ? 0 : errno;
+       if (mkdir(path, 0770) < 0)
+               return (errno == EEXIST) ? 0 : -errno;
 
-       return ret;
+       return 0;
 }