Commit 314c98d5 authored by Michael Hennerich's avatar Michael Hennerich Committed by Bryan Wu

Blackfin arch: add missing gpio error handling to make sure we roll back requests in case one fails

Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarBryan Wu <bryan.wu@analog.com>
parent 06039e90
...@@ -711,10 +711,16 @@ int peripheral_request_list(unsigned short per[], const char *label) ...@@ -711,10 +711,16 @@ int peripheral_request_list(unsigned short per[], const char *label)
int ret; int ret;
for (cnt = 0; per[cnt] != 0; cnt++) { for (cnt = 0; per[cnt] != 0; cnt++) {
ret = peripheral_request(per[cnt], label); ret = peripheral_request(per[cnt], label);
if (ret < 0)
if (ret < 0) {
for ( ; cnt > 0; cnt--) {
peripheral_free(per[cnt - 1]);
}
return ret; return ret;
} }
}
return 0; return 0;
} }
......
...@@ -212,10 +212,17 @@ int peripheral_request_list(unsigned short per[], const char *label) ...@@ -212,10 +212,17 @@ int peripheral_request_list(unsigned short per[], const char *label)
int ret; int ret;
for (cnt = 0; per[cnt] != 0; cnt++) { for (cnt = 0; per[cnt] != 0; cnt++) {
ret = peripheral_request(per[cnt], label); ret = peripheral_request(per[cnt], label);
if (ret < 0)
if (ret < 0) {
for ( ; cnt > 0; cnt--) {
peripheral_free(per[cnt - 1]);
}
return ret; return ret;
} }
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment