aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/st.c7
-rw-r--r--drivers/scsi/st.h1
2 files changed, 3 insertions, 5 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 22ddca891e17..50dbe14db37b 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3749,7 +3749,7 @@ static struct st_buffer *new_tape_buffer(int need_dma, int max_sg)
3749 printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n"); 3749 printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n");
3750 return NULL; 3750 return NULL;
3751 } 3751 }
3752 tb->frp_segs = tb->orig_frp_segs = 0; 3752 tb->frp_segs = 0;
3753 tb->use_sg = max_sg; 3753 tb->use_sg = max_sg;
3754 tb->dma = need_dma; 3754 tb->dma = need_dma;
3755 tb->buffer_size = 0; 3755 tb->buffer_size = 0;
@@ -3839,11 +3839,11 @@ static void normalize_buffer(struct st_buffer * STbuffer)
3839{ 3839{
3840 int i, order = STbuffer->map_data.page_order; 3840 int i, order = STbuffer->map_data.page_order;
3841 3841
3842 for (i = STbuffer->orig_frp_segs; i < STbuffer->frp_segs; i++) { 3842 for (i = 0; i < STbuffer->frp_segs; i++) {
3843 __free_pages(STbuffer->reserved_pages[i], order); 3843 __free_pages(STbuffer->reserved_pages[i], order);
3844 STbuffer->buffer_size -= (PAGE_SIZE << order); 3844 STbuffer->buffer_size -= (PAGE_SIZE << order);
3845 } 3845 }
3846 STbuffer->frp_segs = STbuffer->orig_frp_segs; 3846 STbuffer->frp_segs = 0;
3847 STbuffer->frp_sg_current = 0; 3847 STbuffer->frp_sg_current = 0;
3848 STbuffer->sg_segs = 0; 3848 STbuffer->sg_segs = 0;
3849 STbuffer->map_data.page_order = 0; 3849 STbuffer->map_data.page_order = 0;
@@ -4304,7 +4304,6 @@ static void scsi_tape_release(struct kref *kref)
4304 tpnt->device = NULL; 4304 tpnt->device = NULL;
4305 4305
4306 if (tpnt->buffer) { 4306 if (tpnt->buffer) {
4307 tpnt->buffer->orig_frp_segs = 0;
4308 normalize_buffer(tpnt->buffer); 4307 normalize_buffer(tpnt->buffer);
4309 kfree(tpnt->buffer->reserved_pages); 4308 kfree(tpnt->buffer->reserved_pages);
4310 kfree(tpnt->buffer); 4309 kfree(tpnt->buffer);
diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h
index d29760776f42..e682f8045034 100644
--- a/drivers/scsi/st.h
+++ b/drivers/scsi/st.h
@@ -51,7 +51,6 @@ struct st_buffer {
51 unsigned char *b_data; 51 unsigned char *b_data;
52 unsigned short use_sg; /* zero or max number of s/g segments for this adapter */ 52 unsigned short use_sg; /* zero or max number of s/g segments for this adapter */
53 unsigned short sg_segs; /* number of segments in s/g list */ 53 unsigned short sg_segs; /* number of segments in s/g list */
54 unsigned short orig_frp_segs; /* number of segments allocated at first try */
55 unsigned short frp_segs; /* number of buffer segments */ 54 unsigned short frp_segs; /* number of buffer segments */
56 unsigned int frp_sg_current; /* driver buffer length currently in s/g list */ 55 unsigned int frp_sg_current; /* driver buffer length currently in s/g list */
57}; 56};