Re: [PATCH v3 1/2] power: supply: PCHG: Peripheral device charger

From: Doug Anderson
Date: Fri Jan 22 2021 - 17:51:12 EST


Hi,

On Fri, Jan 22, 2021 at 2:07 PM Daisuke Nojiri <dnojiri@xxxxxxxxxxxx> wrote:
>
> +static int cros_ec_notify(struct notifier_block *nb,
> + unsigned long queued_during_suspend,
> + void *data)
> +{
> + struct cros_ec_device *ec_dev = (struct cros_ec_device *)data;
> + u32 host_event = cros_ec_get_host_event(ec_dev);
> + struct charger_data *charger =
> + container_of(nb, struct charger_data, notifier);
> + u32 device_event_mask;
> +
> + if (!host_event)
> + return NOTIFY_BAD;

Drive-by bug report: the above should be NOTIFY_DONE. By returning
NOTIFY_BAD you're preventing other people on the call chain that come
after you from receiving any events that aren't "host events".
Specifically this includes keyboard events, switch events, etc.

The patch <https://crrev.com/c/2645556> contains the fix.

-Doug