From 8c4e938dcff62632a6de0aaa99ba7ed457fc5f61 Mon Sep 17 00:00:00 2001 From: Rohith Kollalsi Date: Mon, 28 Mar 2022 23:12:52 +0530 Subject: [PATCH] usb: f_cdev: Fix failure in function resume in f_cdev Currently there is a fault in implementation of function suspend and resume in f_cdev. In case when function suspend is issued by the host and then cleared, still cser_resume is not being performed. This is due to incorrect handling of if else condition in usb_cser_func_suspend. Fix this by adding proper handling. Change-Id: I4f0e4c6c02d4b30f2fe0b67bc39a4fac9dbf96f1 Signed-off-by: Rohith Kollalsi --- drivers/usb/gadget/function/f_cdev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/gadget/function/f_cdev.c b/drivers/usb/gadget/function/f_cdev.c index 9de5f19f3bbf..33d3a37dafd9 100644 --- a/drivers/usb/gadget/function/f_cdev.c +++ b/drivers/usb/gadget/function/f_cdev.c @@ -610,11 +610,11 @@ static int usb_cser_func_suspend(struct usb_function *f, u8 options) if (!port->func_is_suspended) { usb_cser_suspend(f); port->func_is_suspended = true; - } else { - if (port->func_is_suspended) { - port->func_is_suspended = false; - usb_cser_resume(f); - } + } + } else { + if (port->func_is_suspended) { + port->func_is_suspended = false; + usb_cser_resume(f); } } return 0;