Re: [PATCH v3 4/4] platform/chrome: cros_ec_chardev: Introduce rwsem for protecting ec_dev
From: Tzung-Bi Shih
Date: Thu May 28 2026 - 00:33:44 EST
On Mon, May 25, 2026 at 05:26:54AM +0000, Tzung-Bi Shih wrote:
> diff --git a/drivers/platform/chrome/cros_ec_chardev.c b/drivers/platform/chrome/cros_ec_chardev.c
> index 7e046fc56998..25ad409523b8 100644
...
> @@ -219,6 +229,10 @@ static __poll_t cros_ec_chardev_poll(struct file *filp, poll_table *wait)
> {
> struct chardev_priv *priv = filp->private_data;
>
> + guard(rwsem_read)(&priv->pdata->ec_dev_sem);
> + if (!priv->pdata->ec_dev)
> + return -ENODEV;
FWIW: I realized -ENODEV isn't a correct return value for poll().
Return EPOLLHUP instead, and squash into the patch.