qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* What is the intended behaviour of usb_host_get_port for root hubs?
@ 2021-03-08 23:54 Ben Leslie
  2021-03-09  7:23 ` Gerd Hoffmann
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Leslie @ 2021-03-08 23:54 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1220 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-09  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-08 23:54 What is the intended behaviour of usb_host_get_port for root hubs? Ben Leslie
2021-03-09  7:23 ` Gerd Hoffmann
2021-03-09  7:43   ` Ben Leslie
2021-03-09  9:43     ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).