USB: gadget: fix up const issue with struct usb_function_instance
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 May 2025 13:41:46 +0000 (15:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2025 10:31:34 +0000 (12:31 +0200)
In struct usb_function, the struct usb_function_instance pointer
variable "fi" is listed as const, but it is written to in numerous
places, making the const marking of it a total lie.  Fix this up by just
removing the const pointer attribute as this is modified in numerous
places.

Link: https://lore.kernel.org/r/2025052145-undress-puma-f7cf@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_mass_storage.h
include/linux/usb/composite.h

index 3b8c4ce2a40a458898c12e333a18f005217c70a9..82ecd3fedb3a1f7b1bc191916782008b9c0fe7d2 100644 (file)
@@ -110,7 +110,7 @@ struct fsg_config {
 };
 
 static inline struct fsg_opts *
-fsg_opts_from_func_inst(const struct usb_function_instance *fi)
+fsg_opts_from_func_inst(struct usb_function_instance *fi)
 {
        return container_of(fi, struct fsg_opts, func_inst);
 }
index 6e38fb9d21174a402485e5cc9acf209a5caceb65..d8c4e9f73839c433301623b32da060cc0b95146c 100644 (file)
@@ -237,7 +237,7 @@ struct usb_function {
        /* internals */
        struct list_head                list;
        DECLARE_BITMAP(endpoints, 32);
-       const struct usb_function_instance *fi;
+       struct usb_function_instance *fi;
 
        unsigned int            bind_deactivated:1;
 };