From: Krzysztof Opasiak Date: Fri, 22 May 2015 15:25:17 +0000 (+0200) Subject: usb: gadget: g_ffs: Fix counting of missing_functions X-Git-Tag: v4.1-rc7~5^2~1^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c41b33c58d11f32e95d06f634ddba0cbf39fc7c6;p=platform%2Fkernel%2Flinux-exynos.git usb: gadget: g_ffs: Fix counting of missing_functions Returning non-zero value from ready callback makes ffs instance return error from writing strings and enter FFS_CLOSING state. This means that this this function is not truly ready and close callback will not be called. This commit fix ffs_ready_callback() to undo all side effects of this function in case of error. Signed-off-by: Krzysztof Opasiak Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/legacy/g_ffs.c b/drivers/usb/gadget/legacy/g_ffs.c index 7b9ef7e..e821931 100644 --- a/drivers/usb/gadget/legacy/g_ffs.c +++ b/drivers/usb/gadget/legacy/g_ffs.c @@ -304,8 +304,10 @@ static int functionfs_ready_callback(struct ffs_data *ffs) gfs_registered = true; ret = usb_composite_probe(&gfs_driver); - if (unlikely(ret < 0)) + if (unlikely(ret < 0)) { + ++missing_funcs; gfs_registered = false; + } return ret; }