git: 8f374fa528d7 - main - ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 19 Feb 2024 10:44:44 UTC
The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=8f374fa528d7643919bca1b4153dde03996305fe commit 8f374fa528d7643919bca1b4153dde03996305fe Author: Andriy Gapon <avg@FreeBSD.org> AuthorDate: 2024-02-19 10:44:00 +0000 Commit: Andriy Gapon <avg@FreeBSD.org> CommitDate: 2024-02-19 10:44:00 +0000 ugen: fix USB_IFACE_DRIVER_ACTIVE after detaching a driver 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 --- sys/dev/usb/usb_generic.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/usb_generic.c b/sys/dev/usb/usb_generic.c index d8bc3a828282..c0af27d77e5d 100644 --- a/sys/dev/usb/usb_generic.c +++ b/sys/dev/usb/usb_generic.c @@ -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;