linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] drivers/acpi/x86: check return null pointer from acpi_evaluate_dsm()
@ 2022-08-28 20:51 Li Zhong
  2022-08-29  5:13 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Li Zhong @ 2022-08-28 20:51 UTC (permalink / raw)
  To: linux-kernel, linux-acpi
  Cc: rafael, lenb, mario.limonciello, hdegoede, Shyam-sundar.S-k,
	mika.westerberg, nakato, lily

From: lily <floridsleeves@gmail.com>

Check return value from acpi_evaluate_dsm(). Only do ACPI_FREE() when
out_obj is not NULL pointers.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 drivers/acpi/x86/s2idle.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index f9ac12b778e6..1b449d3cfbf7 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -328,7 +328,8 @@ static void acpi_sleep_run_lps0_dsm(unsigned int func, unsigned int func_mask, g
 
 	out_obj = acpi_evaluate_dsm(lps0_device_handle, &dsm_guid,
 					rev_id, func, NULL);
-	ACPI_FREE(out_obj);
+	if (!out_obj)
+		ACPI_FREE(out_obj);
 
 	acpi_handle_debug(lps0_device_handle, "_DSM function %u evaluation %s\n",
 			  func, out_obj ? "successful" : "failed");
-- 
2.25.1


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

* Re: [PATCH v1] drivers/acpi/x86: check return null pointer from acpi_evaluate_dsm()
  2022-08-28 20:51 [PATCH v1] drivers/acpi/x86: check return null pointer from acpi_evaluate_dsm() Li Zhong
@ 2022-08-29  5:13 ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2022-08-29  5:13 UTC (permalink / raw)
  To: Li Zhong
  Cc: linux-kernel, linux-acpi, rafael, lenb, mario.limonciello,
	hdegoede, Shyam-sundar.S-k, nakato

Hi,

On Sun, Aug 28, 2022 at 01:51:20PM -0700, Li Zhong wrote:
> From: lily <floridsleeves@gmail.com>
> 
> Check return value from acpi_evaluate_dsm(). Only do ACPI_FREE() when
> out_obj is not NULL pointers.

ACPI_FREE() expands to kfree() and that allows NULL pointers so I don't
think this patch is necessary.

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

end of thread, other threads:[~2022-08-29  5:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-28 20:51 [PATCH v1] drivers/acpi/x86: check return null pointer from acpi_evaluate_dsm() Li Zhong
2022-08-29  5:13 ` Mika Westerberg

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