firewire: core: fw_iso_resource_manage: fix error handling
authorClemens Ladisch <clemens@ladisch.de>
Mon, 15 Mar 2010 12:20:32 +0000 (13:20 +0100)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Mon, 15 Mar 2010 13:29:44 +0000 (14:29 +0100)
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>
drivers/firewire/core-iso.c

index 1c0b504a42f3068e852fa1b7423ee5c37bfb0abd..99c20f1b613ab65f7ea6349647d47b1a4803a222 100644 (file)
@@ -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;
        }
 }