firewire: core: fw_iso_resource_manage: fix error handling

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, March 26, 2010 - 3:59 pm

Gitweb:     http://git.kernel.org/linus/cf36df6bfb49fd265a39f676bfc9718029fef160
Commit:     cf36df6bfb49fd265a39f676bfc9718029fef160
Parent:     6fdb2ee243404c7cbf530387bf904ad1841ebf5b
Author:     Clemens Ladisch <clemens@ladisch.de>
AuthorDate: Mon Mar 15 13:20:32 2010 +0100
Committer:  Stefan Richter <stefanr@s5r6.in-berlin.de>
CommitDate: Mon Mar 15 14:29:44 2010 +0100

    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>
---
 drivers/firewire/core-iso.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c
index 1c0b504..99c20f1 100644
--- a/drivers/firewire/core-iso.c
+++ b/drivers/firewire/core-iso.c
@@ -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;
 	}
 }
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
firewire: core: fw_iso_resource_manage: fix error handling, Linux Kernel Mailing ..., (Fri Mar 26, 3:59 pm)