[PATCH] ACPI: LPSS: Fix missing check in register_device_clock

From: huhai
Date: Thu Jun 23 2022 - 09:21:30 EST


From: huhai <huhai@xxxxxxxxxx>

register_device_clock() misses a check for platform_device_register_simple().
Add a check to fix it.

Signed-off-by: huhai <huhai@xxxxxxxxxx>
---
drivers/acpi/acpi_lpss.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index fbe0756259c5..c4d4d21391d7 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -422,6 +422,9 @@ static int register_device_clock(struct acpi_device *adev,
if (!lpss_clk_dev)
lpt_register_clock_device();

+ if (IS_ERR(lpss_clk_dev))
+ return PTR_ERR(lpss_clk_dev);
+
clk_data = platform_get_drvdata(lpss_clk_dev);
if (!clk_data)
return -ENODEV;
--
2.27.0


No virus found
Checked by Hillstone Network AntiVirus