Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: gadget: udc: fix const issue in gadget_match_driver()

gadget_match_driver() takes a const pointer, and then decides to cast it
away into a non-const one, which is not a good thing to do overall. Fix
this up by properly setting the pointers to be const to preserve that
attribute.

Fixes: d69d80484598 ("driver core: have match() callback in struct bus_type take a const *")
Link: https://lore.kernel.org/r/2025052139-rash-unsaddle-7c5e@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+1 -1
+1 -1
drivers/usb/gadget/udc/core.c
··· 1570 1570 { 1571 1571 struct usb_gadget *gadget = dev_to_usb_gadget(dev); 1572 1572 struct usb_udc *udc = gadget->udc; 1573 - struct usb_gadget_driver *driver = container_of(drv, 1573 + const struct usb_gadget_driver *driver = container_of(drv, 1574 1574 struct usb_gadget_driver, driver); 1575 1575 1576 1576 /* If the driver specifies a udc_name, it must match the UDC's name */