Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf36df6b authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Stefan Richter
Browse files

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: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 6fdb2ee2
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -331,7 +331,8 @@ void fw_iso_resource_manage(struct fw_card *card, int generation,
	if (ret < 0)
	if (ret < 0)
		*bandwidth = 0;
		*bandwidth = 0;


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