Blackfin arch: add missing gpio error handling to make sure we roll back requests...
authorMichael Hennerich <michael.hennerich@analog.com>
Tue, 24 Jul 2007 10:03:45 +0000 (18:03 +0800)
committerBryan Wu <bryan.wu@analog.com>
Tue, 24 Jul 2007 10:03:45 +0000 (18:03 +0800)
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
arch/blackfin/kernel/bfin_gpio.c
arch/blackfin/mach-bf548/gpio.c

index b818a8da121557302534986be3d2eb43b17bba41..979cf79d379955d5dac3c924da06a7021b1e4fe9 100644 (file)
@@ -711,9 +711,15 @@ int peripheral_request_list(unsigned short per[], const char *label)
        int ret;
 
        for (cnt = 0; per[cnt] != 0; cnt++) {
+
                ret = peripheral_request(per[cnt], label);
-               if (ret < 0)
-                       return ret;
+
+               if (ret < 0) {
+                       for ( ; cnt > 0; cnt--) {
+                               peripheral_free(per[cnt - 1]);
+                       }
+               return ret;
+               }
        }
 
        return 0;
index c073ab36066dff5b1a70f3febe1b0ba5c91781c8..f3b9deacd332aab25282e59bdb8f5f8f7844e637 100644 (file)
@@ -212,11 +212,18 @@ int peripheral_request_list(unsigned short per[], const char *label)
        int ret;
 
        for (cnt = 0; per[cnt] != 0; cnt++) {
+
                ret = peripheral_request(per[cnt], label);
-               if (ret < 0)
-                       return ret;
+
+               if (ret < 0) {
+                       for ( ; cnt > 0; cnt--) {
+                               peripheral_free(per[cnt - 1]);
+                       }
+               return ret;
+               }
        }
 
+
        return 0;
 }
 EXPORT_SYMBOL(peripheral_request_list);