Fix Mass Storage Host Class driver GetMaxLUN command - incorrect function return...
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / MassStorage.c
index 2d2f042..ead7768 100644 (file)
@@ -274,8 +274,10 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* MSInterfaceInf
        \r
        if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t),\r
                                             NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)\r
-         return ErrorCode;\r
-         \r
+       {\r
+               return ErrorCode;\r
+       }\r
+       \r
        Pipe_ClearIN();\r
        Pipe_Freeze();\r
        \r
@@ -322,14 +324,10 @@ uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t* Max
                \r
        Pipe_SelectPipe(PIPE_CONTROLPIPE);\r
 \r
-       if ((ErrorCode = USB_Host_SendControlRequest(MaxLUNIndex)) == HOST_SENDCONTROL_SetupStalled)\r
-       {\r
-               Pipe_ClearStall();\r
-\r
-               *MaxLUNIndex = 0;\r
-       }\r
+       if ((ErrorCode = USB_Host_SendControlRequest(MaxLUNIndex)) != HOST_SENDCONTROL_Successful)\r
+         *MaxLUNIndex = 0;\r
        \r
-       return HOST_SENDCONTROL_SetupStalled;\r
+       return ErrorCode;\r
 }\r
 \r
 uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* MSInterfaceInfo, uint8_t LUNIndex, SCSI_Inquiry_Response_t* InquiryData)\r