Skip to content

Commit 25dd360

Browse files
andy-shevgregkh
authored andcommitted
x86: pmc-atom: Assign debugfs node as soon as possible
commit 1b43d71 upstream. 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: f855911 (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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 805f25c commit 25dd360

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎arch/x86/kernel/pmc_atom.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev)
217217
if (!dir)
218218
return -ENOMEM;
219219

220+
pmc->dbgfs_dir = dir;
221+
220222
f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO,
221223
dir, pmc, &pmc_dev_state_ops);
222224
if (!f) {
@@ -229,7 +231,7 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev)
229231
dev_err(&pdev->dev, "sleep_state register failed\n");
230232
goto err;
231233
}
232-
pmc->dbgfs_dir = dir;
234+
233235
return 0;
234236
err:
235237
pmc_dbgfs_unregister(pmc);

0 commit comments

Comments
 (0)