Re: [PATCH] mfd: cros_ec: Drop OF node reference in ec_device_probe()
From: Xiangwu Lai
Date: Wed Nov 18 2026 - 01:30:32 EST
Hi Benson,
Thanks a lot for the review! You are right on all three points:
- moving the of_find_compatible_node() call out of the condition broke
the short-circuit evaluation and made every probe (including the
secondary MCUs) walk the whole device tree for "google,cros-ec-ucsi";
- testing !np after of_node_put() evaluated the pointer after its
reference had already been dropped;
- and the extra declaration was redundant, given the existing
"struct device_node *node" in ec_device_probe().
I have sent v2 scoping the lookup to the UCSI block with
__free(device_node) exactly as you suggested, which keeps the
short-circuit evaluation and releases the reference automatically:
[PATCH v2] mfd: cros_ec: Drop OF node reference in ec_device_probe()
https://lore.kernel.org/r/20261118062949.1250-1-laixiangwu@xxxxxxxxxxxxxxxxxxxx
Best regards,
Xiangwu Lai