Re: [PATCHv4 3/4] OMAP3: Devkit8000: Check return value of gpio_request

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

 



Hello.

On 19-01-2011 11:19, Thomas Weber wrote:

The return value of gpio_request is ignored.
This patch adds the check of the return value of gpio_request.

Signed-off-by: Thomas Weber<weber@xxxxxxxxxxxxx>
---
  arch/arm/mach-omap2/board-devkit8000.c |   16 ++++++++++++++--
  1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 9fb416b..4ddd81c 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
[...]
@@ -244,13 +246,23 @@ static int devkit8000_twl_gpio_setup(struct device *dev,

  	/* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */
  	devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0;
-	gpio_request(devkit8000_lcd_device.reset_gpio, "LCD_PWREN");
+	ret = gpio_request(devkit8000_lcd_device.reset_gpio, "LCD_PWREN");
+	if (ret < 0) {
+		printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n");
+		return ret;
+	}
+
  	/* Disable until needed */
  	gpio_direction_output(devkit8000_lcd_device.reset_gpio, 0);

  	/* gpio + 7 is "DVI_PD" (out, active low) */
  	devkit8000_dvi_device.reset_gpio = gpio + 7;
-	gpio_request(devkit8000_dvi_device.reset_gpio, "DVI PowerDown");
+	ret = gpio_request(devkit8000_dvi_device.reset_gpio, "DVI PowerDown");
+	if (ret < 0) {
+		printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n");

   You forgot to call:

		gpio_free(devkit8000_lcd_device.reset_gpio);

+		return ret;
+	}
+
  	/* Disable until needed */
  	gpio_direction_output(devkit8000_dvi_device.reset_gpio, 0);

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


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux