arm: tegra: cardhu: fix coverity issue
Sri Krishna chowdary [Sun, 14 Oct 2012 08:54:38 +0000 (13:54 +0530)]
check return values.

Bug 1046331

Change-Id: I216759d1f897c8d248430bbc208b2af459539b36
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/144376
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

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

index 2584396..2fab8a5 100644 (file)
@@ -914,6 +914,7 @@ struct spi_board_info rm31080a_cardhu_spi_board[1] = {
 static int __init cardhu_touch_init(void)
 {
        struct board_info BoardInfo, DisplayBoardInfo;
+       int ret;
 
        tegra_get_board_info(&BoardInfo);
        tegra_get_display_board_info(&DisplayBoardInfo);
@@ -930,11 +931,28 @@ static int __init cardhu_touch_init(void)
                                        &rm31080a_cardhu_spi_board[0],
                                        ARRAY_SIZE(rm31080a_cardhu_spi_board));
        } else {
-               gpio_request(TEGRA_GPIO_PH4, "atmel-irq");
-               gpio_direction_input(TEGRA_GPIO_PH4);
-
-               gpio_request(TEGRA_GPIO_PH6, "atmel-reset");
-               gpio_direction_output(TEGRA_GPIO_PH6, 0);
+               ret = gpio_request(TEGRA_GPIO_PH4, "atmel-irq");
+               if (ret < 0) {
+                       pr_err("%s() Error in gpio_request() for gpio %d\n",
+                                       __func__, ret);
+               }
+               ret = gpio_direction_input(TEGRA_GPIO_PH4);
+               if (ret < 0) {
+                       pr_err("%s() Error in setting gpio %d to in/out\n",
+                                        __func__, ret);
+                       gpio_free(TEGRA_GPIO_PH4);
+               }
+               ret = gpio_request(TEGRA_GPIO_PH6, "atmel-reset");
+               if (ret < 0) {
+                       pr_err("%s() Error in gpio_request() for gpio %d\n",
+                                       __func__, ret);
+               }
+               ret = gpio_direction_output(TEGRA_GPIO_PH6, 0);
+               if (ret < 0) {
+                       pr_err("%s() Error in setting gpio %d to in/out\n",
+                                        __func__, ret);
+                       gpio_free(TEGRA_GPIO_PH6);
+               }
                msleep(1);
                gpio_set_value(TEGRA_GPIO_PH6, 1);
                msleep(100);