Re: [PATCH 1/2] platform/chrome: cros_ec_uart: check ACPI companion before use

From: Tzung-Bi Shih

Date: Wed Oct 28 2026 - 23:20:50 EST


On Wed, Oct 28, 2026 at 01:11:59PM +0800, Jiale Yao wrote:
> diff --git a/drivers/platform/chrome/cros_ec_uart.c b/drivers/platform/chrome/cros_ec_uart.c
> index d5b37414ff12..779aabd16674 100644
> --- a/drivers/platform/chrome/cros_ec_uart.c
> +++ b/drivers/platform/chrome/cros_ec_uart.c
> @@ -223,9 +223,13 @@ static int cros_ec_uart_resource(struct acpi_resource *ares, void *data)
>
> static int cros_ec_uart_acpi_probe(struct cros_ec_uart *ec_uart)
> {
> - int ret;
> + struct acpi_device *adev;
> LIST_HEAD(resources);
> - struct acpi_device *adev = ACPI_COMPANION(&ec_uart->serdev->dev);
> + int ret;
> +
> + adev = ACPI_COMPANION(&ec_uart->serdev->dev);
> + if (!adev)
> + return -ENODEV;
>
> ret = acpi_dev_get_resources(adev, &resources, cros_ec_uart_resource, ec_uart);
> if (ret < 0)

NACK, acpi_dev_get_resources() already checks `adev` and return an error
if it is NULL.