From 8a577211f20083944999f658acad4b0cb788ea9b Mon Sep 17 00:00:00 2001 From: Devyn Liu Date: Thu, 14 Dec 2023 17:29:42 +0800 Subject: [PATCH] Add the verification operation after the bus recovery operation obtains resources through the ACPI driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8OIOG ---------------------------------------------------------- If the device does not support obtaining resources through ACPI, the obtained adev pointer may be null. After obtaining resources through ACPI, add whether to support ACPI and null pointer check. Signed-off-by: Devyn Liu (cherry picked from commit d4fdfda16ab7963834d1d8676bb2aea49a8e60a6) --- drivers/i2c/busses/i2c-hisi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-hisi.c b/drivers/i2c/busses/i2c-hisi.c index e6e40236e6ec..0381b91f9be8 100644 --- a/drivers/i2c/busses/i2c-hisi.c +++ b/drivers/i2c/busses/i2c-hisi.c @@ -499,7 +499,10 @@ static void hisi_i2c_init_recovery_info(struct hisi_i2c_controller *ctlr) struct acpi_device *adev = ACPI_COMPANION(ctlr->dev); struct gpio_desc *gpio; - if (!acpi_has_method(adev->handle, HISI_I2C_PIN_MUX_METHOD)) + if (acpi_disabled) + return; + + if (!adev || !acpi_has_method(adev->handle, HISI_I2C_PIN_MUX_METHOD)) return; gpio = devm_gpiod_get_optional(ctlr->dev, "scl", GPIOD_OUT_HIGH); -- Gitee