From: Krzysztof Opasiak Date: Wed, 21 May 2014 12:05:35 +0000 (+0200) Subject: usb: gadget: FunctionFS: Return -ENOENT instead of -ENODEV when device not found. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d668b4f3cb43522158987f70b5d7744b583c551d;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git usb: gadget: FunctionFS: Return -ENOENT instead of -ENODEV when device not found. Syscall mount returns -ENODEV error if requested FS type has not been found. Returning the same error from FFS mount callback makes value returned to userspace misleading. Other file systems returns -ENOENT if requested device has not been found. Adjust FFS to this convention to make error codes meaningfull. Acked-by: Michal Nazarewicz Signed-off-by: Krzysztof Opasiak Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 74202d67f911..88d6fa2290fd 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c @@ -2899,12 +2899,12 @@ static void *ffs_acquire_dev(const char *dev_name) ffs_dev = _ffs_find_dev(dev_name); if (!ffs_dev) - ffs_dev = ERR_PTR(-ENODEV); + ffs_dev = ERR_PTR(-ENOENT); else if (ffs_dev->mounted) ffs_dev = ERR_PTR(-EBUSY); else if (ffs_dev->ffs_acquire_dev_callback && ffs_dev->ffs_acquire_dev_callback(ffs_dev)) - ffs_dev = ERR_PTR(-ENODEV); + ffs_dev = ERR_PTR(-ENOENT); else ffs_dev->mounted = true; diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index fe12e6a27448..06acfa55864a 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c @@ -276,7 +276,7 @@ module_exit(gfs_exit); static void *functionfs_acquire_dev(struct ffs_dev *dev) { if (!try_module_get(THIS_MODULE)) - return ERR_PTR(-ENODEV); + return ERR_PTR(-ENOENT); return 0; }