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

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
This commit is contained in:
Michael Hennerich 2007-07-24 18:03:45 +08:00 committed by Bryan Wu
parent 06039e90b9
commit 314c98d589
2 changed files with 17 additions and 4 deletions

View file

@ -711,9 +711,15 @@ 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)
return ret; if (ret < 0) {
for ( ; cnt > 0; cnt--) {
peripheral_free(per[cnt - 1]);
}
return ret;
}
} }
return 0; return 0;

View file

@ -212,11 +212,18 @@ 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)
return ret; if (ret < 0) {
for ( ; cnt > 0; cnt--) {
peripheral_free(per[cnt - 1]);
}
return ret;
}
} }
return 0; return 0;
} }
EXPORT_SYMBOL(peripheral_request_list); EXPORT_SYMBOL(peripheral_request_list);