Skip to contentSkip to conversation

Fix compilation warning for drivers/leds/leds_gpio.c

PATCH RESEND In review Subrata Modak 1 participant 1 message Jul 21, 2009 LED

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 3/6 Fix compilation warning for drivers/leds/leds_gpio.c

gcc 4.4.1 generates the following build warning on i386:

drivers/leds/leds-gpio.c:75: warning: 'create_gpio_led' defined but not used drivers/leds/leds-gpio.c:126: warning: 'delete_gpio_led' defined but not used drivers/leds/leds-gpio.c: In function 'gpio_led_init':
drivers/leds/leds-gpio.c:316: warning: 'ret' is used uninitialized in this function

Fix them as below:
1) Put the definitions of create_gpio_led() and delete_gpio_led() inside:
"#ifdef CONFIG_LEDS_GPIO_PLATFORM"
when you are actually using them only inside:
"#ifdef CONFIG_LEDS_GPIO_PLATFORM"

2) And then initialize "ret = 0", as Ingo suggests:
http://lkml.org/lkml/2009/7/18/89,

This patch is rebased from an earlier version:
http://lkml.org/lkml/2009/7/14/361,

---

drivers/leds/leds-gpio.c +2 -2
@@ -29,6 +29,7 @@ struct gpio_led_data {
 			unsigned long *delay_on, unsigned long *delay_off);
 };
 
+#ifdef CONFIG_LEDS_GPIO_PLATFORM
 static void gpio_led_work(struct work_struct *work)
 {
 	struct gpio_led_data	*led_dat =
@@ -132,7 +133,6 @@ static void delete_gpio_led(struct gpio_
 	gpio_free(led->gpio);
 }
 
-#ifdef CONFIG_LEDS_GPIO_PLATFORM
 static int __devinit gpio_led_probe(struct platform_device *pdev)
 {
 	struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
@@ -298,7 +298,7 @@ static struct of_platform_driver of_gpio
 
 static int __init gpio_led_init(void)
 {
-	int ret;
+	int ret = 0;
 
 #ifdef CONFIG_LEDS_GPIO_PLATFORM	
 	ret = platform_driver_register(&gpio_led_driver);

---
Regards--
Subrata