2019-03-21 21:06:56

by egranata

[permalink] [raw]
Subject: [PATCH] mfd: cros_ec: Only register a positive IRQ number

From: Enrico Granata <[email protected]>

Add a layer of sanity checking to cros_ec_register against attempting to
register IRQ values that are not strictly greater than 0.

Signed-off-by: Enrico Granata <[email protected]>
---
drivers/mfd/cros_ec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
index 6acfe036d5222..ff8984a2b8c21 100644
--- a/drivers/mfd/cros_ec.c
+++ b/drivers/mfd/cros_ec.c
@@ -118,7 +118,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
return err;
}

- if (ec_dev->irq) {
+ if (ec_dev->irq > 0) {
err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
"chromeos-ec", ec_dev);
--
2.21.0.225.g810b269d1ac-goog



2019-03-22 19:45:51

by Enric Balletbo i Serra

[permalink] [raw]
Subject: Re: [PATCH] mfd: cros_ec: Only register a positive IRQ number

Hi Enrico,

On 21/3/19 22:03, [email protected] wrote:
> From: Enrico Granata <[email protected]>
>
> Add a layer of sanity checking to cros_ec_register against attempting to
> register IRQ values that are not strictly greater than 0.
>
> Signed-off-by: Enrico Granata <[email protected]>
> ---
> drivers/mfd/cros_ec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
> index 6acfe036d5222..ff8984a2b8c21 100644
> --- a/drivers/mfd/cros_ec.c
> +++ b/drivers/mfd/cros_ec.c
> @@ -118,7 +118,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
> return err;
> }
>
> - if (ec_dev->irq) {
> + if (ec_dev->irq > 0) {
> err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
> ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> "chromeos-ec", ec_dev);
>

Acked-by: Enric Balletbo i Serra <[email protected]>

Thanks,
Enric

2019-03-22 21:16:59

by Benson Leung

[permalink] [raw]
Subject: Re: [PATCH] mfd: cros_ec: Only register a positive IRQ number

Hi Enrico,

On Thu, Mar 21, 2019 at 02:03:47PM -0700, [email protected] wrote:
> From: Enrico Granata <[email protected]>
>
> Add a layer of sanity checking to cros_ec_register against attempting to
> register IRQ values that are not strictly greater than 0.
>
> Signed-off-by: Enrico Granata <[email protected]>

Acked-By: Benson Leung <[email protected]>

> ---
> drivers/mfd/cros_ec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c
> index 6acfe036d5222..ff8984a2b8c21 100644
> --- a/drivers/mfd/cros_ec.c
> +++ b/drivers/mfd/cros_ec.c
> @@ -118,7 +118,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev)
> return err;
> }
>
> - if (ec_dev->irq) {
> + if (ec_dev->irq > 0) {
> err = devm_request_threaded_irq(dev, ec_dev->irq, NULL,
> ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> "chromeos-ec", ec_dev);
> --
> 2.21.0.225.g810b269d1ac-goog
>

--
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
[email protected]
Chromium OS Project
[email protected]


Attachments:
(No filename) (1.11 kB)
signature.asc (849.00 B)
Download all attachments