qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What is the intended behaviour of usb_host_get_port for root hubs?


From: Ben Leslie
Subject: What is the intended behaviour of usb_host_get_port for root hubs?
Date: Tue, 9 Mar 2021 10:54:15 +1100

When usb_host_get_port is called for a root-hub device what string should be output in the port parameter?

The current behaviour writes a string with whatever stack value happened to be in the paths stack array.

Possible behaviours that I can see being useful are:

1: Don't modify the port parameter.
2: Write an empty string.

My preference would be for #2, but possibly #1 is intended. I can provide a patch if someone can let me know the intended behaviour. If #1 is intended, then I think the usage in hmp_info_usbhost might need changing as well. The other usage in usb_host_auto_check where the provided port parameter is set to "-" prior to calling the function; it's not clear what the intent of that is. Finally, the function returns zero on error and string length on success (which actually makes #2 a problem), however none of the callers check the return value, so perhaps it can be made a void function? Or possibly it should return -1 on error, rather than zero.

Regards,

Ben

reply via email to

[Prev in Thread] Current Thread [Next in Thread]