diff options
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index efcbcd182863..96af195224f2 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -737,16 +737,14 @@ static int sd_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq) | |||
737 | goto out; | 737 | goto out; |
738 | } | 738 | } |
739 | 739 | ||
740 | rq->completion_data = page; | ||
740 | blk_add_request_payload(rq, page, len); | 741 | blk_add_request_payload(rq, page, len); |
741 | ret = scsi_setup_blk_pc_cmnd(sdp, rq); | 742 | ret = scsi_setup_blk_pc_cmnd(sdp, rq); |
742 | rq->buffer = page_address(page); | ||
743 | rq->__data_len = nr_bytes; | 743 | rq->__data_len = nr_bytes; |
744 | 744 | ||
745 | out: | 745 | out: |
746 | if (ret != BLKPREP_OK) { | 746 | if (ret != BLKPREP_OK) |
747 | __free_page(page); | 747 | __free_page(page); |
748 | rq->buffer = NULL; | ||
749 | } | ||
750 | return ret; | 748 | return ret; |
751 | } | 749 | } |
752 | 750 | ||
@@ -842,10 +840,9 @@ static void sd_unprep_fn(struct request_queue *q, struct request *rq) | |||
842 | { | 840 | { |
843 | struct scsi_cmnd *SCpnt = rq->special; | 841 | struct scsi_cmnd *SCpnt = rq->special; |
844 | 842 | ||
845 | if (rq->cmd_flags & REQ_DISCARD) { | 843 | if (rq->cmd_flags & REQ_DISCARD) |
846 | free_page((unsigned long)rq->buffer); | 844 | __free_page(rq->completion_data); |
847 | rq->buffer = NULL; | 845 | |
848 | } | ||
849 | if (SCpnt->cmnd != rq->cmd) { | 846 | if (SCpnt->cmnd != rq->cmd) { |
850 | mempool_free(SCpnt->cmnd, sd_cdb_pool); | 847 | mempool_free(SCpnt->cmnd, sd_cdb_pool); |
851 | SCpnt->cmnd = NULL; | 848 | SCpnt->cmnd = NULL; |