Skip to content

Commit

Permalink
usb: phy: phy-fsl-usb: Make structure fsl_otg_initdata constant
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nishka Dasgupta authored and Felipe Balbi committed Aug 28, 2019
1 parent c33f141 commit f1b1900
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/phy/phy-fsl-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down

0 comments on commit f1b1900

Please sign in to comment.