aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 49c98730bb8d..91e316fe6522 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -179,7 +179,7 @@ typedef struct sg_device { /* holds the state of each scsi generic device */
179/* tasklet or soft irq callback */ 179/* tasklet or soft irq callback */
180static void sg_rq_end_io(struct request *rq, int uptodate); 180static void sg_rq_end_io(struct request *rq, int uptodate);
181static int sg_start_req(Sg_request *srp, unsigned char *cmd); 181static int sg_start_req(Sg_request *srp, unsigned char *cmd);
182static void sg_finish_rem_req(Sg_request * srp); 182static int sg_finish_rem_req(Sg_request * srp);
183static int sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size); 183static int sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size);
184static ssize_t sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, 184static ssize_t sg_new_read(Sg_fd * sfp, char __user *buf, size_t count,
185 Sg_request * srp); 185 Sg_request * srp);
@@ -518,7 +518,7 @@ sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
518 goto err_out; 518 goto err_out;
519 } 519 }
520err_out: 520err_out:
521 sg_finish_rem_req(srp); 521 err = sg_finish_rem_req(srp);
522 return (0 == err) ? count : err; 522 return (0 == err) ? count : err;
523} 523}
524 524
@@ -1697,9 +1697,10 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd)
1697 return res; 1697 return res;
1698} 1698}
1699 1699
1700static void 1700static int sg_finish_rem_req(Sg_request * srp)
1701sg_finish_rem_req(Sg_request * srp)
1702{ 1701{
1702 int ret = 0;
1703
1703 Sg_fd *sfp = srp->parentfp; 1704 Sg_fd *sfp = srp->parentfp;
1704 Sg_scatter_hold *req_schp = &srp->data; 1705 Sg_scatter_hold *req_schp = &srp->data;
1705 1706
@@ -1711,12 +1712,14 @@ sg_finish_rem_req(Sg_request * srp)
1711 1712
1712 if (srp->rq) { 1713 if (srp->rq) {
1713 if (srp->bio) 1714 if (srp->bio)
1714 blk_rq_unmap_user(srp->bio); 1715 ret = blk_rq_unmap_user(srp->bio);
1715 1716
1716 blk_put_request(srp->rq); 1717 blk_put_request(srp->rq);
1717 } 1718 }
1718 1719
1719 sg_remove_request(sfp, srp); 1720 sg_remove_request(sfp, srp);
1721
1722 return ret;
1720} 1723}
1721 1724
1722static int 1725static int