Skip to content

Commit cf36df6

Browse files
cladischStefan Richter
authored andcommitted
firewire: core: fw_iso_resource_manage: fix error handling
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 <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
1 parent 6fdb2ee commit cf36df6

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎drivers/firewire/core-iso.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,9 @@ void fw_iso_resource_manage(struct fw_card *card, int generation,
331331
if (ret < 0)
332332
*bandwidth = 0;
333333

334-
if (allocate && ret < 0 && c >= 0) {
335-
deallocate_channel(card, irm_id, generation, c, buffer);
334+
if (allocate && ret < 0) {
335+
if (c >= 0)
336+
deallocate_channel(card, irm_id, generation, c, buffer);
336337
*channel = ret;
337338
}
338339
}

0 commit comments

Comments
 (0)