All of lore.kernel.org
 help / color / mirror / Atom feed
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
Date: Fri, 08 Nov 2013 08:24:49 +0000	[thread overview]
Message-ID: <20131108082449.GA19368@elgon.mountain> (raw)
In-Reply-To: <20131107072230.GA32127@gchen.bj.intel.com>

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

WARNING: multiple messages have this Message-ID (diff)
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
Date: Fri, 8 Nov 2013 00:24:49 -0800 (PST)	[thread overview]
Message-ID: <20131108082449.GA19368@elgon.mountain> (raw)
In-Reply-To: <20131107072230.GA32127@gchen.bj.intel.com>

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

  reply	other threads:[~2013-11-08  8:24 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         ` Dan Carpenter [this message]
2013-11-08  8:24           ` [patch 2/2 v2] " Dan Carpenter
2013-11-11  2:04           ` Chen, Gong
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=20131108082449.GA19368@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=gong.chen@linux.intel.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.