lists.openwall.net   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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1204799091-11880-1-git-send-email-Uwe.Kleine-Koenig@digi.com>
Date:	Thu,  6 Mar 2008 11:24:51 +0100
From:	Uwe Kleine-König <Uwe.Kleine-Koenig@...i.com>
To:	linux-kernel@...r.kernel.org
Cc:	Raphael Assenat <raph@...com>, Richard Purdie <rpurdie@...ys.net>
Subject: [PATCH] call gpio_cansleep only after gpio_request succeeded

If you have GPIO_LIB gpio_cansleep oopses on an invalid
gpio.  So better gpio_request your pin first.

Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@...i.com>
Acked-by: David Brownell <dbrownell@...rs.sourceforge.net>
Cc: Raphael Assenat <raph@...com>
Cc: Richard Purdie <rpurdie@...ys.net>
---
Hello,

I already sent that patch on Thu, 14 Feb 2008.  Since then I changed

	gpio_request(led_dat->gpio, ...

to

	gpio_request(cur_led->gpio, ...

because at that time led_dat->gpio isn't initialized yet.

And I got the Acked-by: David.

Best regards
Uwe

---
 drivers/leds/leds-gpio.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 6c0a9c4..d13b622 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -79,6 +79,10 @@ static int gpio_led_probe(struct platform_device *pdev)
 		cur_led = &pdata->leds[i];
 		led_dat = &leds_data[i];
 
+		ret = gpio_request(cur_led->gpio, cur_led->name);
+		if (ret < 0)
+			goto err;
+
 		led_dat->cdev.name = cur_led->name;
 		led_dat->cdev.default_trigger = cur_led->default_trigger;
 		led_dat->gpio = cur_led->gpio;
@@ -87,10 +91,6 @@ static int gpio_led_probe(struct platform_device *pdev)
 		led_dat->cdev.brightness_set = gpio_led_set;
 		led_dat->cdev.brightness = LED_OFF;
 
-		ret = gpio_request(led_dat->gpio, led_dat->cdev.name);
-		if (ret < 0)
-			goto err;
-
 		gpio_direction_output(led_dat->gpio, led_dat->active_low);
 
 		INIT_WORK(&led_dat->work, gpio_led_work);
-- 
1.5.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ