提交 cf36df6b 编写于 作者: C Clemens Ladisch 提交者: Stefan Richter

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: NClemens Ladisch <clemens@ladisch.de>
Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
上级 6fdb2ee2
...@@ -331,8 +331,9 @@ void fw_iso_resource_manage(struct fw_card *card, int generation, ...@@ -331,8 +331,9 @@ 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) {
deallocate_channel(card, irm_id, generation, c, buffer); if (c >= 0)
deallocate_channel(card, irm_id, generation, c, buffer);
*channel = ret; *channel = ret;
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册