mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Zhong <floridsleeves@gmail.com>
To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: rafael@kernel.org, Li Zhong <floridsleeves@gmail.com>
Subject: [PATCH v1] drivers/acpi/acpi_video: check return value of acpi_get_parent()
Date: Fri,  2 Sep 2022 00:41:44 -0700	[thread overview]
Message-ID: <20220902074144.2209674-1-floridsleeves@gmail.com> (raw)

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

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 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


             reply	other threads:[~2022-09-02  7:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02  7:41 Li Zhong [this message]
2022-09-10 16:17 ` Rafael J. Wysocki
2022-09-17  1:25   ` Li Zhong

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=20220902074144.2209674-1-floridsleeves@gmail.com \
    --to=floridsleeves@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®