]> Pileus Git - ~andy/linux/blobdiff - drivers/scsi/sg.c
Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~andy/linux] / drivers / scsi / sg.c
index 747a5e5c1276f62feb3f12f4c2ade154797e6d0b..040f751809ea97c4e09af568aa327e178e9f4218 100644 (file)
@@ -1708,11 +1708,6 @@ static int sg_finish_rem_req(Sg_request * srp)
        Sg_scatter_hold *req_schp = &srp->data;
 
        SCSI_LOG_TIMEOUT(4, printk("sg_finish_rem_req: res_used=%d\n", (int) srp->res_used));
-       if (srp->res_used)
-               sg_unlink_reserve(sfp, srp);
-       else
-               sg_remove_scat(req_schp);
-
        if (srp->rq) {
                if (srp->bio)
                        ret = blk_rq_unmap_user(srp->bio);
@@ -1720,6 +1715,11 @@ static int sg_finish_rem_req(Sg_request * srp)
                blk_put_request(srp->rq);
        }
 
+       if (srp->res_used)
+               sg_unlink_reserve(sfp, srp);
+       else
+               sg_remove_scat(req_schp);
+
        sg_remove_request(sfp, srp);
 
        return ret;