Fixed incorrect use of errno in usb cfs client 13/228813/1
authorINSUN PYO <insun.pyo@samsung.com>
Wed, 25 Mar 2020 22:29:34 +0000 (07:29 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 26 Mar 2020 01:24:41 +0000 (01:24 +0000)
Change-Id: Ib091544138444c4108c7b09eb3e70e830661648e
(cherry picked from commit d8d490bd8049ccad9e5a8bede183ce63bbb7e78d)

hw/usb_cfs_client_common.c

index 0a1990b4512d15b4087bf1eb1aebd51f60055249..f03395c01bb29417080b3957eadf75ad7646c663 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;
 }