diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2015-01-14 11:39:31 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-20 06:50:14 -0500 |
commit | 1b43d7125f3b6f7d46e72da64f65f3187a83b66b (patch) | |
tree | 3ae13345688fcbf4e6636074ab9b99f14468e67b | |
parent | 2b261f9f7bd9333e62140ca7e02a2f4ffec5e44f (diff) |
x86: pmc-atom: Assign debugfs node as soon as possible
pmc_dbgfs_unregister() will be called when pmc->dbgfs_dir is unconditionally
NULL on error path in pmc_dbgfs_register(). To prevent this we move the
assignment to where is should be.
Fixes: f855911c1f48 (x86/pmc_atom: Expose PMC device state and platform sleep state)
Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Aubrey Li <aubrey.li@linux.intel.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Kumar P. Mahesh <mahesh.kumar.p@intel.com>
Link: http://lkml.kernel.org/r/1421253575-22509-2-git-send-email-andriy.shevchenko@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/kernel/pmc_atom.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c index 0ee5025e0fa4..8bb9a611ca23 100644 --- a/arch/x86/kernel/pmc_atom.c +++ b/arch/x86/kernel/pmc_atom.c | |||
@@ -217,6 +217,8 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) | |||
217 | if (!dir) | 217 | if (!dir) |
218 | return -ENOMEM; | 218 | return -ENOMEM; |
219 | 219 | ||
220 | pmc->dbgfs_dir = dir; | ||
221 | |||
220 | f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, | 222 | f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, |
221 | dir, pmc, &pmc_dev_state_ops); | 223 | dir, pmc, &pmc_dev_state_ops); |
222 | if (!f) { | 224 | if (!f) { |
@@ -229,7 +231,7 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) | |||
229 | dev_err(&pdev->dev, "sleep_state register failed\n"); | 231 | dev_err(&pdev->dev, "sleep_state register failed\n"); |
230 | goto err; | 232 | goto err; |
231 | } | 233 | } |
232 | pmc->dbgfs_dir = dir; | 234 | |
233 | return 0; | 235 | return 0; |
234 | err: | 236 | err: |
235 | pmc_dbgfs_unregister(pmc); | 237 | pmc_dbgfs_unregister(pmc); |