diff mbox

[2/2,v2] ACPI, extlog: remove unneeded NULL check

Message ID 20131108082449.GA19368@elgon.mountain (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Dan Carpenter Nov. 8, 2013, 8:24 a.m. UTC
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.

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Chen Gong Nov. 11, 2013, 2:04 a.m. UTC | #1
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>
diff mbox

Patch

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);