[PATCH 3/8] input: gpio_keys_polled: avoid possible division by zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The poll_interval field is used as a divider in the computation of
the threshold value. Check the passed value in the probe routine,
and return -EINVAL if it has not been set in the platform data.

Signed-off-by: Gabor Juhos <juhosg@xxxxxxxxxxx>
---
 drivers/input/keyboard/gpio_keys_polled.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index 5275c9e..9636c2f 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -114,8 +114,8 @@ static int __devinit gpio_keys_polled_probe(struct platform_device *pdev)
 	int error;
 	int i;
 
-	if (!pdata)
-		return -ENXIO;
+	if (!pdata || !pdata->poll_interval)
+		return -EINVAL;
 
 	bdev = kzalloc(sizeof(struct gpio_keys_polled_dev) +
 		       pdata->nbuttons * sizeof(struct gpio_keys_button_data),
-- 
1.7.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux