From: Chenyuan Yang <chenyuan0y@gmail.com>
To: heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org,
lk@c--e.de, dmitry.baryshkov@linaro.org,
u.kleine-koenig@baylibre.com, diogo.ivo@tecnico.ulisboa.pt,
saranya.gopal@intel.com
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Chenyuan Yang <chenyuan0y@gmail.com>
Subject: [PATCH] usb: typec: ucsi: acpi: Add Null check for adev
Date: Thu, 13 Mar 2025 11:22:11 -0500 [thread overview]
Message-ID: <20250313162211.3650958-1-chenyuan0y@gmail.com> (raw)
Not all devices have an ACPI companion fwnode, so adev might be NULL.
This is similar to the commit cd2fd6eab480
("platform/x86: int3472: Check for adev == NULL").
Add a check for adev not being set and return -ENODEV in that case to
avoid a possible NULL pointer deref in ucsi_acpi_probe().
Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
---
drivers/usb/typec/ucsi/ucsi_acpi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
index ac1ebb5d9527..d517914c6439 100644
--- a/drivers/usb/typec/ucsi/ucsi_acpi.c
+++ b/drivers/usb/typec/ucsi/ucsi_acpi.c
@@ -189,6 +189,9 @@ static int ucsi_acpi_probe(struct platform_device *pdev)
acpi_status status;
int ret;
+ if (!adev)
+ return -ENODEV;
+
if (adev->dep_unmet)
return -EPROBE_DEFER;
--
2.34.1
next reply other threads:[~2025-03-13 16:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 16:22 Chenyuan Yang [this message]
2025-03-14 7:29 ` Krzysztof Kozlowski
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=20250313162211.3650958-1-chenyuan0y@gmail.com \
--to=chenyuan0y@gmail.com \
--cc=diogo.ivo@tecnico.ulisboa.pt \
--cc=dmitry.baryshkov@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lk@c--e.de \
--cc=saranya.gopal@intel.com \
--cc=u.kleine-koenig@baylibre.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 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®