lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Thu, 20 Sep 2007 10:01:48 +0300
From:	Anti Sullin <>
To:	LKML <>
Subject: [PATCH 1/2][resend 2] gpio_keys: add gpio_to_irq return code check

As David Brownell pointed out when reviewing my suspend patch to 
gpio_keys, the original gpio_keys driver does not check gpio_to_irq 
return code.

This patch adds the gpio_to_irq return code check to gpio_keys and 
moves the IRQ edge type setting to request_irq flags to avoid changing 
the irq type before we have confirmed we can use it.

Signed-off-by: Anti Sullin <> 
Resent: Return code changed to irq error value

diff -pur clean/linux-2.6.23-rc5-at91/drivers/input/keyboard/gpio_keys.c linux-2.6.23-rc5-at91/drivers/input/keyboard/gpio_keys.c
--- clean/linux-2.6.23-rc5-at91/drivers/input/keyboard/gpio_keys.c	2007-09-01 09:08:24.000000000 +0300
+++ linux-2.6.23-rc5-at91/drivers/input/keyboard/gpio_keys.c	2007-09-18 19:27:25.000000000 +0300
@@ -77,10 +77,16 @@ static int __devinit gpio_keys_probe(str
		int irq = gpio_to_irq(button->gpio);
		unsigned int type = button->type ?: EV_KEY;

-		set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
-		error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM,
-				     button->desc ? button->desc : "gpio_keys",
-				     pdev);
+		if (irq < 0) {
+			error = irq;
+			printk(KERN_ERR "gpio-keys: unable to get irq number for GPIO %d; error %d\n",
+				button->gpio, error);
+			goto fail;
+		}
+		error = request_irq(irq, gpio_keys_isr, 
+				     button->desc ? button->desc : "gpio_keys", pdev);
		if (error) {
			printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n",
				irq, error);

Anti Sullin
Embedded Software Engineer
Artec Design LLC
Türi 10C, 11313, Tallinn, Estonia

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists