From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Greg KH <greg@kroah.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>,
Chunyan Zhang <zhang.chunyan@linaro.org>,
laurent.fert@intel.com, yann.fouassier@intel.com,
linux-kernel@vger.kernel.org,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: [QUEUED v20160408 03/18] stm class: dummy_stm: Make nr_dummies parameter read-only
Date: Fri, 8 Apr 2016 17:56:26 +0300 [thread overview]
Message-ID: <1460127401-30801-4-git-send-email-alexander.shishkin@linux.intel.com> (raw)
In-Reply-To: <1460127401-30801-1-git-send-email-alexander.shishkin@linux.intel.com>
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>
---
drivers/hwtracing/stm/dummy_stm.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/hwtracing/stm/dummy_stm.c b/drivers/hwtracing/stm/dummy_stm.c
index 310adf57e7..a86612d989 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];
static int nr_dummies = 4;
-module_param(nr_dummies, int, 0600);
-
-static unsigned int dummy_stm_nr;
+module_param(nr_dummies, int, 0400);
static unsigned int fail_mode;
@@ -65,12 +63,12 @@ static int dummy_stm_link(struct stm_data *data, unsigned int master,
static int dummy_stm_init(void)
{
- int i, ret = -ENOMEM, __nr_dummies = ACCESS_ONCE(nr_dummies);
+ int i, ret = -ENOMEM;
- if (__nr_dummies < 0 || __nr_dummies > DUMMY_STM_MAX)
+ if (nr_dummies < 0 || nr_dummies > DUMMY_STM_MAX)
return -EINVAL;
- for (i = 0; i < __nr_dummies; i++) {
+ for (i = 0; i < nr_dummies; i++) {
dummy_stm[i].name = kasprintf(GFP_KERNEL, "dummy_stm.%d", i);
if (!dummy_stm[i].name)
goto fail_unregister;
@@ -86,8 +84,6 @@ static int dummy_stm_init(void)
goto fail_free;
}
- dummy_stm_nr = __nr_dummies;
-
return 0;
fail_unregister:
@@ -105,7 +101,7 @@ static void dummy_stm_exit(void)
{
int i;
- for (i = 0; i < dummy_stm_nr; i++) {
+ for (i = 0; i < nr_dummies; i++) {
stm_unregister_device(&dummy_stm[i]);
kfree(dummy_stm[i].name);
}
--
2.8.0.rc3
next prev parent reply other threads:[~2016-04-08 14:57 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-08 14:56 [QUEUED v20160408 00/18] stm class/intel_th: Patches in my queue Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 01/18] MAINTAINERS: Add a git tree for the stm class Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 02/18] stm class: Fix integer boundary checks for master range Alexander Shishkin
2016-04-08 14:56 ` Alexander Shishkin [this message]
2016-04-08 14:56 ` [QUEUED v20160408 04/18] stm class: stm_heartbeat: Make nr_devs parameter read-only Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 05/18] stm class: Remove a pointless line Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 06/18] stm class: Do not leak the chrdev in error path Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 07/18] stm class: Fix stm device initialization order Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 08/18] stm class: Remove unnecessary pointer increment Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 09/18] intel_th: pti: Do remove sysfs group on device removal Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 10/18] intel_th: msu: Handle kstrndup() failure Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 11/18] intel_th: Allow subdevice drivers to bring in own attribute groups Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 12/18] intel_th: msu: Create sysfs attributes using core driver's facility Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 13/18] intel_th: pti: " Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 14/18] intel_th: Fix activating a subdevice without a driver Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 15/18] intel_th: msu: Serialize enabling/disabling Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 16/18] intel_th: Hold output driver module reference while capture is active Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 17/18] intel_th: msu: Set fops::owner to prevent module from unloading Alexander Shishkin
2016-04-08 14:56 ` [QUEUED v20160408 18/18] intel_th: msu: Release resources on removal Alexander Shishkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460127401-30801-4-git-send-email-alexander.shishkin@linux.intel.com \
--to=alexander.shishkin@linux.intel.com \
--cc=greg@kroah.com \
--cc=laurent.fert@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=yann.fouassier@intel.com \
--cc=zhang.chunyan@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome