1
0
Fork 0

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>
hifive-unleashed-5.1
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;
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;

View 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);