diff mbox

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

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

Commit Message

Dan Carpenter Nov. 5, 2013, 8:20 p.m. UTC
We dereference extlog_l1_addr so the check is too late.  The
"extlog_l1_addr" pointer can never be NULL when this function is called
so I have removed the check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

Rafael J. Wysocki Nov. 6, 2013, 10:06 p.m. UTC | #1
On Tuesday, November 05, 2013 11:20:07 PM Dan Carpenter wrote:
> We dereference extlog_l1_addr so the check is too late.  The
> "extlog_l1_addr" pointer can never be NULL when this function is called
> so I have removed the check.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

I'm wondering what kernel you have checked, because drivers/acpi/acpi_extlog.c
is not present in the mainline or even in linux-next?

Rafael


> 
> diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
> index c4d5e59..d59e4bb 100644
> --- a/drivers/acpi/acpi_extlog.c
> +++ b/drivers/acpi/acpi_extlog.c
> @@ -308,8 +308,7 @@ 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);
> +	acpi_os_unmap_memory(extlog_l1_addr, l1_size);
>  	if (elog_addr)
>  		acpi_os_unmap_memory(elog_addr, elog_size);
>  	release_mem_region(elog_base, elog_size);
> --
> 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
Tony Luck Nov. 6, 2013, 10:45 p.m. UTC | #2
On Wed, Nov 6, 2013 at 2:06 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> I'm wondering what kernel you have checked, because drivers/acpi/acpi_extlog.c
> is not present in the mainline or even in linux-next?

It's in the "tip" tree ... and seems to be in next-20131106

-Tony
--
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
Rafael J. Wysocki Nov. 7, 2013, 12:09 a.m. UTC | #3
On Wednesday, November 06, 2013 02:45:18 PM Tony Luck wrote:
> On Wed, Nov 6, 2013 at 2:06 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > I'm wondering what kernel you have checked, because drivers/acpi/acpi_extlog.c
> > is not present in the mainline or even in linux-next?
> 
> It's in the "tip" tree ... and seems to be in next-20131106

Well, OK.  Who's going to maintain this file?

Rafael

--
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
Chen Gong Nov. 7, 2013, 7:22 a.m. UTC | #4
On Thu, Nov 07, 2013 at 01:09:38AM +0100, Rafael J. Wysocki wrote:
> Date: Thu, 07 Nov 2013 01:09:38 +0100
> From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> To: Tony Luck <tony.luck@gmail.com>
> Cc: Dan Carpenter <dan.carpenter@oracle.com>, Len Brown <lenb@kernel.org>,
>  Gong <gong.chen@linux.intel.com>, linux-acpi <linux-acpi@vger.kernel.org>,
>  kernel-janitors@vger.kernel.org
> Subject: Re: [patch 2/2] ACPI, extlog: remove unneeded NULL check
> User-Agent: KMail/4.10.5 (Linux/3.12.0-rc6+; KDE/4.10.5; x86_64; ; )
> 
> On Wednesday, November 06, 2013 02:45:18 PM Tony Luck wrote:
> > On Wed, Nov 6, 2013 at 2:06 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > > I'm wondering what kernel you have checked, because drivers/acpi/acpi_extlog.c
> > > is not present in the mainline or even in linux-next?
> > 
> > It's in the "tip" tree ... and seems to be in next-20131106
> 
> Well, OK.  Who's going to maintain this file?
> 
> Rafael
> 
It's me. I will maintain this file.

BTW, Dan

According to your codes, I think elog_addr check can be removed, too.
Can you send out a updated version?
diff mbox

Patch

diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
index c4d5e59..d59e4bb 100644
--- a/drivers/acpi/acpi_extlog.c
+++ b/drivers/acpi/acpi_extlog.c
@@ -308,8 +308,7 @@  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);
+	acpi_os_unmap_memory(extlog_l1_addr, l1_size);
 	if (elog_addr)
 		acpi_os_unmap_memory(elog_addr, elog_size);
 	release_mem_region(elog_base, elog_size);