Commit 25dd360c authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

x86: pmc-atom: Assign debugfs node as soon as possible

commit 1b43d712 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: f855911c (x86/pmc_atom: Expose PMC device state and platform sleep state)
Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAndy 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.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 805f25c4
...@@ -217,6 +217,8 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) ...@@ -217,6 +217,8 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev)
if (!dir) if (!dir)
return -ENOMEM; return -ENOMEM;
pmc->dbgfs_dir = dir;
f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO,
dir, pmc, &pmc_dev_state_ops); dir, pmc, &pmc_dev_state_ops);
if (!f) { if (!f) {
...@@ -229,7 +231,7 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev) ...@@ -229,7 +231,7 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc, struct pci_dev *pdev)
dev_err(&pdev->dev, "sleep_state register failed\n"); dev_err(&pdev->dev, "sleep_state register failed\n");
goto err; goto err;
} }
pmc->dbgfs_dir = dir;
return 0; return 0;
err: err:
pmc_dbgfs_unregister(pmc); pmc_dbgfs_unregister(pmc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment