arm: tegra: cardhu: fix coverity issue
Sri Krishna chowdary [Sun, 14 Oct 2012 08:32:19 +0000 (13:32 +0530)]
Check return values from gpio_request and
gpio_direction_input.

Bug 1046331

Change-Id: Iea97537572242430bed42d730543f740d1f56b04
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/144375
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>

arch/arm/mach-tegra/board-cardhu-pinmux.c

index cb7112a..a485ca7 100644 (file)
@@ -612,8 +612,17 @@ static __initdata struct tegra_pingroup_config gmi_pins_269[] = {
 
 static void __init cardhu_pinmux_audio_init(void)
 {
-       gpio_request(TEGRA_GPIO_CDC_IRQ, "wm8903");
-       gpio_direction_input(TEGRA_GPIO_CDC_IRQ);
+       int ret = gpio_request(TEGRA_GPIO_CDC_IRQ, "wm8903");
+       if (ret < 0) {
+               pr_err("%s() Error in gpio_request() for gpio %d\n",
+                                       __func__, ret);
+       }
+       ret = gpio_direction_input(TEGRA_GPIO_CDC_IRQ);
+       if (ret < 0) {
+               pr_err("%s() Error in setting gpio %d to in/out\n",
+                                       __func__, ret);
+               gpio_free(TEGRA_GPIO_CDC_IRQ);
+       }
 }
 
 #define GPIO_INIT_PIN_MODE(_gpio, _is_input, _value)   \