All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chen, Gong" <gong.chen@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Len Brown <lenb@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-acpi@vger.kernel.org, Tony Luck <tony.luck@gmail.com>,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch 2/2 v2] ACPI, extlog: remove unneeded NULL check
Date: Mon, 11 Nov 2013 02:04:44 +0000	[thread overview]
Message-ID: <20131111020444.GA1740@gchen.bj.intel.com> (raw)
In-Reply-To: <20131108082449.GA19368@elgon.mountain>

[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]

On Fri, Nov 08, 2013 at 12:24:49AM -0800, Dan Carpenter wrote:
> Date: Fri, 8 Nov 2013 00:24:49 -0800 (PST)
> From: Dan Carpenter <dan.carpenter@oracle.com>
> To: Len Brown <lenb@kernel.org>, "Chen, Gong" <gong.chen@linux.intel.com>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>, linux-acpi@vger.kernel.org,
>  Tony Luck <tony.luck@gmail.com>, kernel-janitors@vger.kernel.org
> Subject: [patch 2/2 v2] ACPI, extlog: remove unneeded NULL check
> USER-AGENT: Mutt/1.5.21 (2010-09-15)
> 
> We dereference extlog_l1_addr before checking if is NULL.  It turns out
> "extlog_l1_addr" pointer can never be NULL when this function is called
> so I have removed the check.
> 
> We can remove the "elog_addr" check as well.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: remove the elog_addr check as well.
> 
> diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
> index a6869e1..17da458 100644
> --- a/drivers/acpi/acpi_extlog.c
> +++ b/drivers/acpi/acpi_extlog.c
> @@ -310,10 +310,8 @@ static void __exit extlog_exit(void)
>  {
>  	mce_unregister_decode_chain(&extlog_mce_dec);
>  	((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN;
> -	if (extlog_l1_addr)
> -		acpi_os_unmap_memory(extlog_l1_addr, l1_size);
> -	if (elog_addr)
> -		acpi_os_unmap_memory(elog_addr, elog_size);
> +	acpi_os_unmap_memory(extlog_l1_addr, l1_size);
> +	acpi_os_unmap_memory(elog_addr, elog_size);
>  	release_mem_region(elog_base, elog_size);
>  	release_mem_region(l1_dirbase, l1_size);
>  	kfree(elog_buf);

Signed-off-by: Chen, Gong <gong.chen@linux.intel.com>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: "Chen, Gong" <gong.chen@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Len Brown <lenb@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	linux-acpi@vger.kernel.org, Tony Luck <tony.luck@gmail.com>,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch 2/2 v2] ACPI, extlog: remove unneeded NULL check
Date: Sun, 10 Nov 2013 21:04:44 -0500	[thread overview]
Message-ID: <20131111020444.GA1740@gchen.bj.intel.com> (raw)
In-Reply-To: <20131108082449.GA19368@elgon.mountain>

[-- Attachment #1: Type: text/plain, Size: 1634 bytes --]

On Fri, Nov 08, 2013 at 12:24:49AM -0800, Dan Carpenter wrote:
> Date: Fri, 8 Nov 2013 00:24:49 -0800 (PST)
> From: Dan Carpenter <dan.carpenter@oracle.com>
> To: Len Brown <lenb@kernel.org>, "Chen, Gong" <gong.chen@linux.intel.com>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>, linux-acpi@vger.kernel.org,
>  Tony Luck <tony.luck@gmail.com>, kernel-janitors@vger.kernel.org
> Subject: [patch 2/2 v2] ACPI, extlog: remove unneeded NULL check
> USER-AGENT: Mutt/1.5.21 (2010-09-15)
> 
> We dereference extlog_l1_addr before checking if is NULL.  It turns out
> "extlog_l1_addr" pointer can never be NULL when this function is called
> so I have removed the check.
> 
> We can remove the "elog_addr" check as well.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: remove the elog_addr check as well.
> 
> diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
> index a6869e1..17da458 100644
> --- a/drivers/acpi/acpi_extlog.c
> +++ b/drivers/acpi/acpi_extlog.c
> @@ -310,10 +310,8 @@ static void __exit extlog_exit(void)
>  {
>  	mce_unregister_decode_chain(&extlog_mce_dec);
>  	((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN;
> -	if (extlog_l1_addr)
> -		acpi_os_unmap_memory(extlog_l1_addr, l1_size);
> -	if (elog_addr)
> -		acpi_os_unmap_memory(elog_addr, elog_size);
> +	acpi_os_unmap_memory(extlog_l1_addr, l1_size);
> +	acpi_os_unmap_memory(elog_addr, elog_size);
>  	release_mem_region(elog_base, elog_size);
>  	release_mem_region(l1_dirbase, l1_size);
>  	kfree(elog_buf);

Signed-off-by: Chen, Gong <gong.chen@linux.intel.com>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-11-11  2:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 20:20 [patch 2/2] ACPI, extlog: remove unneeded NULL check Dan Carpenter
2013-11-05 20:20 ` Dan Carpenter
2013-11-06 21:54 ` Rafael J. Wysocki
2013-11-06 22:06   ` Rafael J. Wysocki
2013-11-06 22:45   ` Tony Luck
2013-11-06 22:45     ` Tony Luck
2013-11-06 23:57     ` Rafael J. Wysocki
2013-11-07  0:09       ` Rafael J. Wysocki
2013-11-07  7:22       ` Chen, Gong
2013-11-07  7:22         ` Chen, Gong
2013-11-08  8:24         ` [patch 2/2 v2] " Dan Carpenter
2013-11-08  8:24           ` Dan Carpenter
2013-11-11  2:04           ` Chen, Gong [this message]
2013-11-11  2:04             ` Chen, Gong

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=20131111020444.GA1740@gchen.bj.intel.com \
    --to=gong.chen@linux.intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=tony.luck@gmail.com \
    /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.