diff options
author | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2016-03-04 09:22:33 -0500 |
---|---|---|
committer | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2016-04-08 09:11:50 -0400 |
commit | 118b4515aa6916ee7751f29c8b2a3af95abc9783 (patch) | |
tree | 576bc15f6b7f387209722d41a82ca8d35735d99f /drivers/hwtracing/stm | |
parent | f57af6df6af23c086cfe023896822200eee48dd1 (diff) |
stm class: dummy_stm: Make nr_dummies parameter read-only
Changing nr_dummies after the module has been loaded doesn't actually
change anything, so just make it read-only.
Reported-by: Alan Cox <alan.cox@intel.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Laurent Fert <laurent.fert@intel.com>
Diffstat (limited to 'drivers/hwtracing/stm')
-rw-r--r-- | drivers/hwtracing/stm/dummy_stm.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/hwtracing/stm/dummy_stm.c b/drivers/hwtracing/stm/dummy_stm.c index 310adf57e7a1..a86612d989f9 100644 --- a/drivers/hwtracing/stm/dummy_stm.c +++ b/drivers/hwtracing/stm/dummy_stm.c | |||
@@ -46,9 +46,7 @@ static struct stm_data dummy_stm[DUMMY_STM_MAX]; | |||
46 | 46 | ||
47 | static int nr_dummies = 4; | 47 | static int nr_dummies = 4; |
48 | 48 | ||
49 | module_param(nr_dummies, int, 0600); | 49 | module_param(nr_dummies, int, 0400); |
50 | |||
51 | static unsigned int dummy_stm_nr; | ||
52 | 50 | ||
53 | static unsigned int fail_mode; | 51 | static unsigned int fail_mode; |
54 | 52 | ||
@@ -65,12 +63,12 @@ static int dummy_stm_link(struct stm_data *data, unsigned int master, | |||
65 | 63 | ||
66 | static int dummy_stm_init(void) | 64 | static int dummy_stm_init(void) |
67 | { | 65 | { |
68 | int i, ret = -ENOMEM, __nr_dummies = ACCESS_ONCE(nr_dummies); | 66 | int i, ret = -ENOMEM; |
69 | 67 | ||
70 | if (__nr_dummies < 0 || __nr_dummies > DUMMY_STM_MAX) | 68 | if (nr_dummies < 0 || nr_dummies > DUMMY_STM_MAX) |
71 | return -EINVAL; | 69 | return -EINVAL; |
72 | 70 | ||
73 | for (i = 0; i < __nr_dummies; i++) { | 71 | for (i = 0; i < nr_dummies; i++) { |
74 | dummy_stm[i].name = kasprintf(GFP_KERNEL, "dummy_stm.%d", i); | 72 | dummy_stm[i].name = kasprintf(GFP_KERNEL, "dummy_stm.%d", i); |
75 | if (!dummy_stm[i].name) | 73 | if (!dummy_stm[i].name) |
76 | goto fail_unregister; | 74 | goto fail_unregister; |
@@ -86,8 +84,6 @@ static int dummy_stm_init(void) | |||
86 | goto fail_free; | 84 | goto fail_free; |
87 | } | 85 | } |
88 | 86 | ||
89 | dummy_stm_nr = __nr_dummies; | ||
90 | |||
91 | return 0; | 87 | return 0; |
92 | 88 | ||
93 | fail_unregister: | 89 | fail_unregister: |
@@ -105,7 +101,7 @@ static void dummy_stm_exit(void) | |||
105 | { | 101 | { |
106 | int i; | 102 | int i; |
107 | 103 | ||
108 | for (i = 0; i < dummy_stm_nr; i++) { | 104 | for (i = 0; i < nr_dummies; i++) { |
109 | stm_unregister_device(&dummy_stm[i]); | 105 | stm_unregister_device(&dummy_stm[i]); |
110 | kfree(dummy_stm[i].name); | 106 | kfree(dummy_stm[i].name); |
111 | } | 107 | } |