All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/acpi: remove dead code
@ 2021-01-11  9:26 Roger Pau Monne
  2021-01-11  9:33 ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Roger Pau Monne @ 2021-01-11  9:26 UTC (permalink / raw)
  To: xen-devel; +Cc: Roger Pau Monne, Jan Beulich, Andrew Cooper, Wei Liu

After the recent changes to acpi_fadt_parse_sleep_info the bad label
can never be called with facs mapped, and hence the unmap can be
removed.

Additionally remove the whole label, since it was used by a
single caller. Move the relevant code from the label.

No functional change intended.

CID: 1471722
Fixes: 16ca5b3f873 ('x86/ACPI: don't invalidate S5 data when S3 wakeup vector cannot be determined')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/acpi/boot.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c
index 6345490f93..73a321d83c 100644
--- a/xen/arch/x86/acpi/boot.c
+++ b/xen/arch/x86/acpi/boot.c
@@ -389,8 +389,14 @@ acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt)
 		}
 	}
 
-	if (fadt->flags & ACPI_FADT_HW_REDUCED)
-		goto bad;
+	if (fadt->flags & ACPI_FADT_HW_REDUCED) {
+		memset(&acpi_sinfo, 0,
+		       offsetof(struct acpi_sleep_info, sleep_control));
+		memset(&acpi_sinfo.sleep_status + 1, 0,
+		       (long)(&acpi_sinfo + 1) -
+		       (long)(&acpi_sinfo.sleep_status + 1));
+		return;
+	}
 
 	acpi_fadt_copy_address(pm1a_cnt, pm1a_control, pm1_control);
 	acpi_fadt_copy_address(pm1b_cnt, pm1b_control, pm1_control);
@@ -458,15 +464,6 @@ acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt)
 	printk(KERN_INFO PREFIX
 	       "            wakeup_vec[%"PRIx64"], vec_size[%x]\n",
 	       acpi_sinfo.wakeup_vector, acpi_sinfo.vector_width);
-	return;
-
- bad:
-	if (facs)
-		acpi_os_unmap_memory(facs, sizeof(*facs));
-	memset(&acpi_sinfo, 0,
-	       offsetof(struct acpi_sleep_info, sleep_control));
-	memset(&acpi_sinfo.sleep_status + 1, 0,
-	       (long)(&acpi_sinfo + 1) - (long)(&acpi_sinfo.sleep_status + 1));
 }
 
 static int __init acpi_parse_fadt(struct acpi_table_header *table)
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/acpi: remove dead code
  2021-01-11  9:26 [PATCH] x86/acpi: remove dead code Roger Pau Monne
@ 2021-01-11  9:33 ` Jan Beulich
  2021-01-11 17:02   ` Roger Pau Monné
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2021-01-11  9:33 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: Andrew Cooper, Wei Liu, xen-devel

On 11.01.2021 10:26, Roger Pau Monne wrote:
> After the recent changes to acpi_fadt_parse_sleep_info the bad label
> can never be called with facs mapped, and hence the unmap can be
> removed.
> 
> Additionally remove the whole label, since it was used by a
> single caller. Move the relevant code from the label.
> 
> No functional change intended.
> 
> CID: 1471722
> Fixes: 16ca5b3f873 ('x86/ACPI: don't invalidate S5 data when S3 wakeup vector cannot be determined')

I kind of consider a "Fixes:" tag contrary to "No functional change
intended", but I guess Coverity considering this an issue warrants
the tag at least in a way.

> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/acpi: remove dead code
  2021-01-11  9:33 ` Jan Beulich
@ 2021-01-11 17:02   ` Roger Pau Monné
  0 siblings, 0 replies; 3+ messages in thread
From: Roger Pau Monné @ 2021-01-11 17:02 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Cooper, Wei Liu, xen-devel

On Mon, Jan 11, 2021 at 10:33:28AM +0100, Jan Beulich wrote:
> On 11.01.2021 10:26, Roger Pau Monne wrote:
> > After the recent changes to acpi_fadt_parse_sleep_info the bad label
> > can never be called with facs mapped, and hence the unmap can be
> > removed.
> > 
> > Additionally remove the whole label, since it was used by a
> > single caller. Move the relevant code from the label.
> > 
> > No functional change intended.
> > 
> > CID: 1471722
> > Fixes: 16ca5b3f873 ('x86/ACPI: don't invalidate S5 data when S3 wakeup vector cannot be determined')
> 
> I kind of consider a "Fixes:" tag contrary to "No functional change
> intended", but I guess Coverity considering this an issue warrants
> the tag at least in a way.

I've just added the tag so that if the original patch was backported
this was also, in order to prevent Coverity complaining again.

Thanks, Roger.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-11 17:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11  9:26 [PATCH] x86/acpi: remove dead code Roger Pau Monne
2021-01-11  9:33 ` Jan Beulich
2021-01-11 17:02   ` Roger Pau Monné

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.