Re: [PATCH v2] mfd: cros_ec: Drop OF node reference in ec_device_probe()
From: Tzung-Bi Shih
Date: Sun Nov 22 2026 - 21:04:00 EST
On Wed, Nov 18, 2026 at 02:29:48PM +0800, Xiangwu Lai wrote:
> diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
> index 529a23b80..b8d363b7a 100644
> --- a/drivers/mfd/cros_ec_dev.c
> +++ b/drivers/mfd/cros_ec_dev.c
> @@ -271,14 +271,20 @@ static int ec_device_probe(struct platform_device *pdev)
> */
> if (cros_ec_check_features(ec, EC_FEATURE_USB_PD) &&
> cros_ec_check_features(ec, EC_FEATURE_UCSI_PPM) &&
> - !acpi_dev_found("GOOG0021") &&
> - !of_find_compatible_node(NULL, NULL, "google,cros-ec-ucsi")) {
> - retval = mfd_add_hotplug_devices(ec->dev,
> - cros_ec_ucsi_cells,
> - ARRAY_SIZE(cros_ec_ucsi_cells));
> + !acpi_dev_found("GOOG0021")) {
> + struct device_node *np __free(device_node) =
> + of_find_compatible_node(NULL, NULL, "google,cros-ec-ucsi");
__free() is defined in <linux/cleanup.h>. Please include it in the file.
Alternatively, simply calling `of_node_put()` after using `np` also works.
>
> - if (retval)
> - dev_warn(ec->dev, "failed to add cros_ec_ucsi: %d\n", retval);
> + if (!np) {
> + retval = mfd_add_hotplug_devices(ec->dev,
> + cros_ec_ucsi_cells,
> + ARRAY_SIZE(cros_ec_ucsi_cells));
./scripts/checkpatch.pl --strict:
CHECK: Alignment should match open parenthesis
#61: FILE: drivers/mfd/cros_ec_dev.c:280:
+ retval = mfd_add_hotplug_devices(ec->dev,
+ cros_ec_ucsi_cells,