]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
esas2r: fir error handling in do_fm_api
authorTomas Henzl <thenzl@redhat.com>
Sun, 16 Nov 2014 13:35:32 +0000 (14:35 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 25 Nov 2014 14:42:51 +0000 (15:42 +0100)
This patch fixes an error path and rearranges error handling.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/esas2r/esas2r_ioctl.c

index d89a0277a8e189f02af169c0d3476267dc8dc135..9ac82075546a2ddb9ca0598272389e916842f4d6 100644 (file)
@@ -117,9 +117,8 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
 
        rq = esas2r_alloc_request(a);
        if (rq == NULL) {
-               up(&a->fm_api_semaphore);
                fi->status = FI_STAT_BUSY;
-               return;
+               goto free_sem;
        }
 
        if (fi == &a->firmware.header) {
@@ -135,7 +134,7 @@ static void do_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi)
                if (a->firmware.header_buff == NULL) {
                        esas2r_debug("failed to allocate header buffer!");
                        fi->status = FI_STAT_BUSY;
-                       return;
+                       goto free_req;
                }
 
                memcpy(a->firmware.header_buff, fi,
@@ -171,9 +170,10 @@ all_done:
                                  a->firmware.header_buff,
                                  (dma_addr_t)a->firmware.header_buff_phys);
        }
-
-       up(&a->fm_api_semaphore);
+free_req:
        esas2r_free_request(a, (struct esas2r_request *)rq);
+free_sem:
+       up(&a->fm_api_semaphore);
        return;
 
 }