提交 ddcae017 编写于 作者: T Tomas Henzl 提交者: Christoph Hellwig

esas2r: fir error handling in do_fm_api

This patch fixes an error path and rearranges error handling.
Signed-off-by: NTomas Henzl <thenzl@redhat.com>
Acked-by: NBradley Grove <bgrove@attotech.com>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
上级 71bd849d
...@@ -117,9 +117,8 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi) ...@@ -117,9 +117,8 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
rq = esas2r_alloc_request(a); rq = esas2r_alloc_request(a);
if (rq == NULL) { if (rq == NULL) {
up(&a->fm_api_semaphore);
fi->status = FI_STAT_BUSY; fi->status = FI_STAT_BUSY;
return; goto free_sem;
} }
if (fi == &a->firmware.header) { if (fi == &a->firmware.header) {
...@@ -135,7 +134,7 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi) ...@@ -135,7 +134,7 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
if (a->firmware.header_buff == NULL) { if (a->firmware.header_buff == NULL) {
esas2r_debug("failed to allocate header buffer!"); esas2r_debug("failed to allocate header buffer!");
fi->status = FI_STAT_BUSY; fi->status = FI_STAT_BUSY;
return; goto free_req;
} }
memcpy(a->firmware.header_buff, fi, memcpy(a->firmware.header_buff, fi,
...@@ -171,9 +170,10 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi) ...@@ -171,9 +170,10 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
a->firmware.header_buff, a->firmware.header_buff,
(dma_addr_t)a->firmware.header_buff_phys); (dma_addr_t)a->firmware.header_buff_phys);
} }
free_req:
up(&a->fm_api_semaphore);
esas2r_free_request(a, (struct esas2r_request *)rq); esas2r_free_request(a, (struct esas2r_request *)rq);
free_sem:
up(&a->fm_api_semaphore);
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册