Re: [PATCH] power: supply: cros_peripheral_charger: unregister EC notifier
From: Tzung-Bi Shih
Date: Tue Jun 16 2026 - 01:59:51 EST
On Mon, Jun 15, 2026 at 02:31:05PM +0800, Pengpeng Hou wrote:
> cros_pchg_probe() registers an EC event notifier whose callback uses the
> devm-allocated charger_data via container_of(). The driver has no
> remove callback and does not unregister the notifier, so the notifier
> chain can retain a pointer to freed driver state after unbind or probe
> cleanup.
>
> Register a devm cleanup action immediately after the notifier is
> installed so the notifier is unregistered before the driver state is
> released. Also fail probe if the notifier cannot be registered, instead
> of leaving a charger device that cannot receive EC events.
>
> Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
A possible nit is to use s/cros_peripheral_charger/cros_pchg/ in the patch
subject to leave more space for the summary.
With or without this,
Reviewed-by: Tzung-Bi Shih <tzungbi@xxxxxxxxxx>