[RESEND PATCH 10/10] usb-hub: Fix handling port power control messages

Guenter Roeck posted 10 patches 1 week, 4 days ago
[RESEND PATCH 10/10] usb-hub: Fix handling port power control messages
Posted by Guenter Roeck 1 week, 4 days ago
The ClearPortFeature control message fails for PORT_POWER because there
is no break; at the end of the case statement, causing it to fall through
to the failure handler. Add the missing break; to solve the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Change from RFC:
    New patch

 hw/usb/dev-hub.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
index 4da91d151c..2872c6712a 100644
--- a/hw/usb/dev-hub.c
+++ b/hw/usb/dev-hub.c
@@ -532,6 +532,7 @@ static void usb_hub_handle_control(USBDevice *dev, USBPacket *p,
                     usb_hub_port_clear(port, PORT_STAT_SUSPEND);
                     port->wPortChange = 0;
                 }
+                break;
             default:
                 goto fail;
             }
-- 
2.45.2
Re: [RESEND PATCH 10/10] usb-hub: Fix handling port power control messages
Posted by Michael Tokarev 5 days, 3 hours ago
12.11.2024 20:01, Guenter Roeck wrote:
> The ClearPortFeature control message fails for PORT_POWER because there
> is no break; at the end of the case statement, causing it to fall through
> to the failure handler. Add the missing break; to solve the problem.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Change from RFC:
>      New patch
> 
>   hw/usb/dev-hub.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
> index 4da91d151c..2872c6712a 100644
> --- a/hw/usb/dev-hub.c
> +++ b/hw/usb/dev-hub.c
> @@ -532,6 +532,7 @@ static void usb_hub_handle_control(USBDevice *dev, USBPacket *p,
>                       usb_hub_port_clear(port, PORT_STAT_SUSPEND);
>                       port->wPortChange = 0;
>                   }
> +                break;
>               default:
>                   goto fail;
>               }

This is wonderful :)

Picking this up for stable series, though it looks like this is
a very minor issue in practice?

Thanks,

/mjt
Re: [RESEND PATCH 10/10] usb-hub: Fix handling port power control messages
Posted by Guenter Roeck 5 days ago
On 11/18/24 08:37, Michael Tokarev wrote:
> 12.11.2024 20:01, Guenter Roeck wrote:
>> The ClearPortFeature control message fails for PORT_POWER because there
>> is no break; at the end of the case statement, causing it to fall through
>> to the failure handler. Add the missing break; to solve the problem.
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>> Change from RFC:
>>      New patch
>>
>>   hw/usb/dev-hub.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
>> index 4da91d151c..2872c6712a 100644
>> --- a/hw/usb/dev-hub.c
>> +++ b/hw/usb/dev-hub.c
>> @@ -532,6 +532,7 @@ static void usb_hub_handle_control(USBDevice *dev, USBPacket *p,
>>                       usb_hub_port_clear(port, PORT_STAT_SUSPEND);
>>                       port->wPortChange = 0;
>>                   }
>> +                break;
>>               default:
>>                   goto fail;
>>               }
> 
> This is wonderful :)
> 
> Picking this up for stable series, though it looks like this is
> a very minor issue in practice?
> 

I can't tell, really. It is just something I stumbled over while testing
the patch series I had submitted.

Guenter


Re: [RESEND PATCH 10/10] usb-hub: Fix handling port power control messages
Posted by Philippe Mathieu-Daudé 5 days, 7 hours ago
On 12/11/24 17:01, Guenter Roeck wrote:
> The ClearPortFeature control message fails for PORT_POWER because there
> is no break; at the end of the case statement, causing it to fall through
> to the failure handler. Add the missing break; to solve the problem.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Change from RFC:
>      New patch
> 
>   hw/usb/dev-hub.c | 1 +
>   1 file changed, 1 insertion(+)

Fixes: 1cc403eb21 ("usb-hub: emulate per port power switching")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>