]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: musb: core: added missing const qualifier to musb_hdrc_platform_data::config
authorPetr Kulhavy <petr@barix.com>
Wed, 24 Feb 2016 15:27:16 +0000 (16:27 +0100)
committerFelipe Balbi <balbi@kernel.org>
Fri, 4 Mar 2016 13:14:46 +0000 (15:14 +0200)
The musb_hdrc_platform_data::config was defined as a non-const pointer.
However some drivers (e.g. the ux500) set up this pointer to point to a
static structure, which is potentially dangerous. Since the musb core
uses the pointer in a read-only manner the const qualifier was added to
protect the content of the config.

Signed-off-by: Petr Kulhavy <petr@barix.com>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_core.h
include/linux/usb/musb.h

index c3791a01ab316dc2773a28c2c53189c635a12f85..39fd95833eb8317b63f4f1e1a781f611bfcda5cd 100644 (file)
@@ -1901,7 +1901,7 @@ static void musb_recover_from_babble(struct musb *musb)
  */
 
 static struct musb *allocate_instance(struct device *dev,
-               struct musb_hdrc_config *config, void __iomem *mbase)
+               const struct musb_hdrc_config *config, void __iomem *mbase)
 {
        struct musb             *musb;
        struct musb_hw_ep       *ep;
index fd215fb45fd408bf707510a746ca58c70751c1de..b6afe9e4330545d6b3bd1d432374d61f7cabbf3f 100644 (file)
@@ -438,7 +438,7 @@ struct musb {
         */
        unsigned                double_buffer_not_ok:1;
 
-       struct musb_hdrc_config *config;
+       const struct musb_hdrc_config *config;
 
        int                     xceiv_old_state;
 #ifdef CONFIG_DEBUG_FS
index 96ddfb7ab018af6f177438629a0d5bb5422ad9c6..0b3da40a525ecf2370f528620d5e85370904325d 100644 (file)
@@ -124,7 +124,7 @@ struct musb_hdrc_platform_data {
        int             (*set_power)(int state);
 
        /* MUSB configuration-specific details */
-       struct musb_hdrc_config *config;
+       const struct musb_hdrc_config *config;
 
        /* Architecture specific board data     */
        void            *board_data;