usb: phy: phy-fsl-usb: Make structure fsl_otg_initdata constant
authorNishka Dasgupta <nishkadg.linux@gmail.com>
Mon, 19 Aug 2019 07:42:34 +0000 (13:12 +0530)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 28 Aug 2019 10:04:59 +0000 (13:04 +0300)
Static structure fsl_otg_initdata, of type fsl_otg_config, is used only
once, when the value of its field otg_port is assigned to another
variable. As fsl_otg_initdata.otg_port is of type u8, any changes to
its copy do not affect the original, and fsl_otg_initdata itself is
never modified. Hence make fsl_otg_initdata constant to protect it from
unintended modification.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/phy/phy-fsl-usb.c

index f7c96d209eda78a73b812685a931c59b53a1a6c8..dbb2d4d548941cac536ace08037f7df13afda9c5 100644 (file)
@@ -65,7 +65,7 @@ struct fsl_otg_timer *b_data_pulse_tmr, *b_vbus_pulse_tmr, *b_srp_fail_tmr,
 
 static struct list_head active_timers;
 
-static struct fsl_otg_config fsl_otg_initdata = {
+static const struct fsl_otg_config fsl_otg_initdata = {
        .otg_port = 1,
 };