On Aug 28, 2015, at 9:50 AM, Gerd Hoffmann wrote: > On Fr, 2015-08-28 at 09:39 -0400, Programmingkid wrote: >> On Aug 28, 2015, at 9:35 AM, Daniel P. Berrange wrote: >> >>> On Fri, Aug 28, 2015 at 09:08:12AM -0400, Programmingkid wrote: >>>> >>>> On Aug 28, 2015, at 7:50 AM, Gerd Hoffmann wrote: >>>> >>>>> On Mo, 2015-08-24 at 15:13 -0400, Programmingkid wrote: >>>>>> + monitor_printf(mon, " Device %d.%d, Port %s, Speed %s >>>>>> Mb/s," >>>>>> + "Product %s, ID %s\n", >>>>>> + bus->busnr, dev->addr, port->path, >>>>>> + usb_speed(dev->speed), >>>>>> + dev->product_desc, dev->qdev.id); >>>>>> >>>>> >>>>> dev->qdev.id can be NULL. >>>>> >>>>> cheers, >>>>> Gerd >>>> >>>> That isn't a problem. It will just say "null" when it is printed. >>>> No crash or garbage text. >>> >>> Handling of '%s' with NULL is undefined by the standard. Linux >>> glibc prints the string "null", but other implementations can >>> crash. >> >> "null" is also printed on Mac OS X. >> >> Do you want dev->qdev.id replaced with this? (dev->qdev.id != NULL) ? >> dev->qdev.id : "null" > > Even better: Don't print "ID: ..." in the first place in case it is not > present.
The ID is printed so if the user needs to remove the device, device_del <id> can be used. If the ID isn't printed here, where do you want it to be printed? "info device-id"?