Skip to content

Commit

Permalink
Blackfin arch: add missing gpio error handling to make sure we roll b…
Browse files Browse the repository at this point in the history
…ack requests in case one fails

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
  • Loading branch information
Michael Hennerich authored and Bryan Wu committed Jul 24, 2007
1 parent 06039e9 commit 314c98d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions arch/blackfin/kernel/bfin_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 9 additions & 2 deletions arch/blackfin/mach-bf548/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 314c98d

Please sign in to comment.