Linux Power Management development
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Len Brown <lenb@kernel.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ACPI / cpuidle: remove superfluous pr == NULL checks
Date: Fri, 30 Aug 2013 14:03:11 +0200	[thread overview]
Message-ID: <4642597.rqCVoqqdF0@vostro.rjw.lan> (raw)
In-Reply-To: <5858980.cRdNx0rNzu@amdc1032>

On Friday, August 30, 2013 12:30:51 PM Bartlomiej Zolnierkiewicz wrote:
> The only acpi_processor_get_power_info_fadt() user
> (acpi_processor_get_power_info()) dereferences pr before calling
> the function.
> 
> The only acpi_processor_hotplug() user (acpi_cpu_soft_notify())
> checks for pr == NULL before calling the function.
> 
> The only acpi_processor_cst_has_changed() user (acpi_processor_notify())
> checks for pr == NULL before calling the function.
> 
> The only acpi_processor_power_init() user (__acpi_processor_start())
> dereferences pr before calling the function.
> 
> Thus remove superfluous pr == NULL checks from affected functions.
> 
> Also:
> 
> While at it remove redundant brackets from acpi_processor_hotplug().
> 
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Len Brown <lenb@kernel.org>

Thanks, I'll queue this up for 3.13.


> ---
>  drivers/acpi/processor_idle.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index f98dd00..35c8f2b 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -272,9 +272,6 @@ static void tsc_check_state(int state) { return; }
>  static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
>  {
>  
> -	if (!pr)
> -		return -EINVAL;
> -
>  	if (!pr->pblk)
>  		return -ENODEV;
>  
> @@ -1076,12 +1073,8 @@ int acpi_processor_hotplug(struct acpi_processor *pr)
>  	if (disabled_by_idle_boot_param())
>  		return 0;
>  
> -	if (!pr)
> -		return -EINVAL;
> -
> -	if (nocst) {
> +	if (nocst)
>  		return -ENODEV;
> -	}
>  
>  	if (!pr->flags.power_setup_done)
>  		return -ENODEV;
> @@ -1108,9 +1101,6 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
>  	if (disabled_by_idle_boot_param())
>  		return 0;
>  
> -	if (!pr)
> -		return -EINVAL;
> -
>  	if (nocst)
>  		return -ENODEV;
>  
> @@ -1183,9 +1173,6 @@ int acpi_processor_power_init(struct acpi_processor *pr)
>  		first_run++;
>  	}
>  
> -	if (!pr)
> -		return -EINVAL;
> -
>  	if (acpi_gbl_FADT.cst_control && !nocst) {
>  		status =
>  		    acpi_os_write_port(acpi_gbl_FADT.smi_command, acpi_gbl_FADT.cst_control, 8);
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

      reply	other threads:[~2013-08-30 12:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30 10:30 [PATCH] ACPI / cpuidle: remove superfluous pr == NULL checks Bartlomiej Zolnierkiewicz
2013-08-30 12:03 ` Rafael J. Wysocki [this message]

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=4642597.rqCVoqqdF0@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=b.zolnierkie@samsung.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.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