Skip to content

Commit

Permalink
ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver
Browse files Browse the repository at this point in the history
Previosuly, USB_IFACE_DRIVER_ACTIVE would report that the driver is
active even after it detached.  That's because a device(9) still
remains.

So, add device_is_alive(9) check for more accurate reporting.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43960
  • Loading branch information
avg-I committed Feb 19, 2024
1 parent b7dce5b commit 8f374fa
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sys/dev/usb/usb_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2377,12 +2377,10 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags)
break;

case USB_IFACE_DRIVER_ACTIVE:

n = *u.pint & 0xFF;

iface = usbd_get_iface(f->udev, n);

if (iface && iface->subdev)
if (iface != NULL && iface->subdev != NULL &&
device_is_alive(iface->subdev))
error = 0;
else
error = ENXIO;
Expand Down

0 comments on commit 8f374fa

Please sign in to comment.