All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: x86@kernel.org, Aubrey Li <aubrey.li@linux.intel.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
	"Kumar P, Mahesh" <mahesh.kumar.p@intel.com>,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v5 1/5] x86: pmc-atom: assign debugfs node as soon as possible
Date: Wed, 14 Jan 2015 18:39:31 +0200	[thread overview]
Message-ID: <1421253575-22509-2-git-send-email-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <1421253575-22509-1-git-send-email-andriy.shevchenko@linux.intel.com>

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 an
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>
---
 arch/x86/kernel/pmc_atom.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c
index 0ee5025e..8bb9a61 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)
 	if (!dir)
 		return -ENOMEM;
 
+	pmc->dbgfs_dir = dir;
+
 	f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO,
 				dir, pmc, &pmc_dev_state_ops);
 	if (!f) {
@@ -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");
 		goto err;
 	}
-	pmc->dbgfs_dir = dir;
+
 	return 0;
 err:
 	pmc_dbgfs_unregister(pmc);
-- 
2.1.4


  reply	other threads:[~2015-01-14 16:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 16:39 [PATCH v5 0/5] x86: clean ups and feature enhancement in pmc_atom Andy Shevchenko
2015-01-14 16:39 ` Andy Shevchenko [this message]
2015-01-20 11:54   ` [tip:x86/platform] x86: pmc-atom: Assign debugfs node as soon as possible tip-bot for Andy Shevchenko
2015-01-14 16:39 ` [PATCH v5 2/5] x86: pmc_atom: don't check for NULL twice Andy Shevchenko
2015-01-20 11:55   ` [tip:x86/platform] x86: pmc_atom: don%27t " tip-bot for Andy Shevchenko
2015-01-14 16:39 ` [PATCH v5 3/5] x86: pmc-atom: remove unused macro Andy Shevchenko
2015-01-20 11:55   ` [tip:x86/platform] x86: pmc-atom: Remove " tip-bot for Andy Shevchenko
2015-01-14 16:39 ` [PATCH v5 4/5] x86: pmc_atom: clean up init function Andy Shevchenko
2015-01-20 11:55   ` [tip:x86/platform] x86: pmc_atom: Clean " tip-bot for Andy Shevchenko
2015-01-14 16:39 ` [PATCH v5 5/5] x86: pmc_atom: expose contents of PSS Andy Shevchenko
2015-01-20 11:56   ` [tip:x86/platform] x86: pmc_atom: Expose " tip-bot for Andy Shevchenko

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=1421253575-22509-2-git-send-email-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=aubrey.li@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mahesh.kumar.p@intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.