* [patch 2/2] ACPI, extlog: remove unneeded NULL check
@ 2013-11-05 20:20 Dan Carpenter
2013-11-06 22:06 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2013-11-05 20:20 UTC (permalink / raw)
To: Len Brown, Chen, Gong; +Cc: Rafael J. Wysocki, linux-acpi, kernel-janitors
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>
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);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [patch 2/2] ACPI, extlog: remove unneeded NULL check
2013-11-05 20:20 [patch 2/2] ACPI, extlog: remove unneeded NULL check Dan Carpenter
@ 2013-11-06 22:06 ` Rafael J. Wysocki
2013-11-06 22:45 ` Tony Luck
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2013-11-06 22:06 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Len Brown, Chen, Gong, linux-acpi, kernel-janitors
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
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch 2/2] ACPI, extlog: remove unneeded NULL check
2013-11-06 22:06 ` Rafael J. Wysocki
@ 2013-11-06 22:45 ` Tony Luck
2013-11-07 0:09 ` Rafael J. Wysocki
0 siblings, 1 reply; 7+ messages in thread
From: Tony Luck @ 2013-11-06 22:45 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Dan Carpenter, Len Brown, Gong, linux-acpi, kernel-janitors
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch 2/2] ACPI, extlog: remove unneeded NULL check
2013-11-06 22:45 ` Tony Luck
@ 2013-11-07 0:09 ` Rafael J. Wysocki
2013-11-07 7:22 ` Chen, Gong
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2013-11-07 0:09 UTC (permalink / raw)
To: Tony Luck; +Cc: Dan Carpenter, Len Brown, Gong, linux-acpi, kernel-janitors
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch 2/2] ACPI, extlog: remove unneeded NULL check
2013-11-07 0:09 ` Rafael J. Wysocki
@ 2013-11-07 7:22 ` Chen, Gong
2013-11-08 8:24 ` [patch 2/2 v2] " Dan Carpenter
0 siblings, 1 reply; 7+ messages in thread
From: Chen, Gong @ 2013-11-07 7:22 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Tony Luck, Dan Carpenter, Len Brown, linux-acpi, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1129 bytes --]
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?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 2/2 v2] ACPI, extlog: remove unneeded NULL check
2013-11-07 7:22 ` Chen, Gong
@ 2013-11-08 8:24 ` Dan Carpenter
2013-11-11 2:04 ` Chen, Gong
0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2013-11-08 8:24 UTC (permalink / raw)
To: Len Brown, Chen, Gong
Cc: Rafael J. Wysocki, linux-acpi, Tony Luck, kernel-janitors
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);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [patch 2/2 v2] ACPI, extlog: remove unneeded NULL check
2013-11-08 8:24 ` [patch 2/2 v2] " Dan Carpenter
@ 2013-11-11 2:04 ` Chen, Gong
0 siblings, 0 replies; 7+ messages in thread
From: Chen, Gong @ 2013-11-11 2:04 UTC (permalink / raw)
To: Dan Carpenter
Cc: Len Brown, Rafael J. Wysocki, linux-acpi, Tony Luck,
kernel-janitors
[-- 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 --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-11-11 2:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-05 20:20 [patch 2/2] ACPI, extlog: remove unneeded NULL check Dan Carpenter
2013-11-06 22:06 ` Rafael J. Wysocki
2013-11-06 22:45 ` Tony Luck
2013-11-07 0:09 ` Rafael J. Wysocki
2013-11-07 7:22 ` Chen, Gong
2013-11-08 8:24 ` [patch 2/2 v2] " Dan Carpenter
2013-11-11 2:04 ` Chen, Gong
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).