usb: dwc3: gadget: return error if command sent to DGCMD register fails
authorSubbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>
Thu, 21 May 2015 10:16:47 +0000 (15:46 +0530)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:09:17 +0000 (13:09 +0000)
commit 891b1dc022955d36cf4c0f42d383226a930db7ed upstream.

We need to return error to caller if command is not sent to
controller succesfully.

Signed-off-by: Subbaraya Sundeep Bhatta <sbhatta@xilinx.com>
Fixes: b09bb64239c8 (usb: dwc3: gadget: implement Global Command support)
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c

index 31472c47b4c5c4533e881856efe80b2d43ad0704..7b3dec0b2a790aea23d84f4788e43d7f09514301 100644 (file)
@@ -305,6 +305,8 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, int cmd, u32 param)
                if (!(reg & DWC3_DGCMD_CMDACT)) {
                        dev_vdbg(dwc->dev, "Command Complete --> %d\n",
                                        DWC3_DGCMD_STATUS(reg));
+                       if (DWC3_DGCMD_STATUS(reg))
+                               return -EINVAL;
                        return 0;
                }