summaryrefslogtreecommitdiff
path: root/block/blk-lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-lib.c')
-rw-r--r--block/blk-lib.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c
index ff2a7f04af4d..9031d2af0b47 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -115,6 +115,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
ret = submit_bio_wait(bio);
if (ret == -EOPNOTSUPP)
ret = 0;
+ bio_put(bio);
}
blk_finish_plug(&plug);
@@ -168,8 +169,10 @@ int blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
}
}
- if (bio)
+ if (bio) {
ret = submit_bio_wait(bio);
+ bio_put(bio);
+ }
return ret != -EOPNOTSUPP ? ret : 0;
}
EXPORT_SYMBOL(blkdev_issue_write_same);
@@ -209,8 +212,11 @@ static int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
}
}
- if (bio)
- return submit_bio_wait(bio);
+ if (bio) {
+ ret = submit_bio_wait(bio);
+ bio_put(bio);
+ return ret;
+ }
return 0;
}