Skip to content

Commit

Permalink
firewire: core: fw_iso_resource_manage: fix error handling
Browse files Browse the repository at this point in the history
If the bandwidth allocation fails, the error must be returned in
*channel regardless of whether the channel allocation succeeded.
Checking for c >= 0 is not correct if no channel allocation was
requested, in which case this part of the code is reached with
c == -EINVAL.

Signed-off-by: Clemens Ladisch <[email protected]>
Signed-off-by: Stefan Richter <[email protected]>
  • Loading branch information
cladisch authored and Stefan Richter committed Mar 15, 2010
1 parent 6fdb2ee commit cf36df6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/firewire/core-iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,9 @@ void fw_iso_resource_manage(struct fw_card *card, int generation,
if (ret < 0)
*bandwidth = 0;

if (allocate && ret < 0 && c >= 0) {
deallocate_channel(card, irm_id, generation, c, buffer);
if (allocate && ret < 0) {
if (c >= 0)
deallocate_channel(card, irm_id, generation, c, buffer);
*channel = ret;
}
}

0 comments on commit cf36df6

Please sign in to comment.