USB: print_usbdevice_full: error out on invalid configuration

should not happen normally, but an inattentive user of that function
may forget to check the validity of the parsed device, so err
on the safe side here

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2022-11-10 15:35:54 +01:00 committed by Thomas Lamprecht
parent 238af88edc
commit b06a24927c

View File

@ -120,6 +120,8 @@ sub print_usbdevice_full {
$usbdevice .= ",vendorid=0x$device->{vendorid},productid=0x$device->{productid}"; $usbdevice .= ",vendorid=0x$device->{vendorid},productid=0x$device->{productid}";
} elsif (defined($device->{hostbus}) && defined($device->{hostport})) { } elsif (defined($device->{hostbus}) && defined($device->{hostport})) {
$usbdevice .= ",hostbus=$device->{hostbus},hostport=$device->{hostport}"; $usbdevice .= ",hostbus=$device->{hostbus},hostport=$device->{hostport}";
} else {
die "no usb id or path given\n";
} }
$usbdevice .= ",id=$deviceid"; $usbdevice .= ",id=$deviceid";