[PATCH v1] drivers/acpi/acpi_video: check return value of acpi_get_parent()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check return status of acpi_get_parent() to confirm whether it fails.

Signed-off-by: Li Zhong <floridsleeves@xxxxxxxxx>
---
 drivers/acpi/acpi_video.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 5cbe2196176d..5fca9a39b1a4 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
+	// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  video.c - ACPI Video Driver
  *
@@ -1753,6 +1753,7 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
 	int result;
 	static int count;
 	char *name;
+	acpi_status status;
 
 	result = acpi_video_init_brightness(device);
 	if (result)
@@ -1766,8 +1767,9 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
 		return;
 	count++;
 
-	acpi_get_parent(device->dev->handle, &acpi_parent);
-
+	status = acpi_get_parent(device->dev->handle, &acpi_parent);
+	if (ACPI_FAILURE(status))
+		return;
 	pdev = acpi_get_pci_dev(acpi_parent);
 	if (pdev) {
 		parent = &pdev->dev;
-- 
2.25.1




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux