linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "H . Peter Anvin" <hpa@linux.intel.com>,
	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
Subject: Re: [PATCH v4 2/3] x86: pmc_atom: don't check for NULL twice
Date: Wed, 19 Nov 2014 12:36:06 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1411191224220.3909@nanos> (raw)
In-Reply-To: <1415812689-17326-3-git-send-email-andriy.shevchenko@linux.intel.com>

On Wed, 12 Nov 2014, Andy Shevchenko wrote:

> debugfs_remove_recursive() is NULL-aware, thus, we may safely remove the check
> here. There is no need to assing NULL to variable since it will be not used
> anywhere.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Aubrey Li <aubrey.li@linux.intel.com>
> ---
>  arch/x86/kernel/pmc_atom.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/arch/x86/kernel/pmc_atom.c b/arch/x86/kernel/pmc_atom.c
> index 19b8efa..bcc91ea 100644
> --- a/arch/x86/kernel/pmc_atom.c
> +++ b/arch/x86/kernel/pmc_atom.c
> @@ -202,11 +202,7 @@ static const struct file_operations pmc_sleep_tmr_ops = {
>  
>  static void pmc_dbgfs_unregister(struct pmc_dev *pmc)
>  {
> -	if (!pmc->dbgfs_dir)
> -		return;
> -
>  	debugfs_remove_recursive(pmc->dbgfs_dir);
> -	pmc->dbgfs_dir = NULL;
>  }

So while the patch is correct per se, the whole function is useless.

pmc_dbgfs_register()

	dir = debugfs_create_dir("pmc_atom", NULL);

	....
	if (!f)
		goto err;

	pmc->dbgfs_dir = dir;
	return 0;
err:
	pmc_dbgfs_unregister(pmc);

So pmc->dbgfs_dir is always NULL when this is called....

Aside of that, if DEBUGFS=n the code keeps pmc->regmap ioremapped for
no reason.

Looking deeper:

The pmc_power_off function is installed _BEFORE_ pmc_hw_reg_setup() is
called, which might not be called if the ioremap fails ....

Thanks,

	tglx



  reply	other threads:[~2014-11-19 11:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 17:18 [PATCH v4 0/3] x86: clean ups and feature enhancement in pmc_atom Andy Shevchenko
2014-11-12 17:18 ` [PATCH v4 1/3] x86: pmc_atom: clean up init function Andy Shevchenko
2014-11-12 17:18 ` [PATCH v4 2/3] x86: pmc_atom: don't check for NULL twice Andy Shevchenko
2014-11-19 11:36   ` Thomas Gleixner [this message]
2014-11-28  9:49     ` Andy Shevchenko
2014-11-12 17:18 ` [PATCH v4 3/3] x86: pmc_atom: expose contents of PSS 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=alpine.DEB.2.11.1411191224220.3909@nanos \
    --to=tglx@linutronix.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=aubrey.li@linux.intel.com \
    --cc=hpa@linux.intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).