Use bio_release_pages instead of open coding it. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- block/bio.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/block/bio.c b/block/bio.c index a6862b954350..3938e179a530 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1370,8 +1370,6 @@ struct bio *bio_map_user_iov(struct request_queue *q, int j; struct bio *bio; int ret; - struct bio_vec *bvec; - struct bvec_iter_all iter_all; if (!iov_iter_count(iter)) return ERR_PTR(-EINVAL); @@ -1438,9 +1436,7 @@ struct bio *bio_map_user_iov(struct request_queue *q, return bio; out_unmap: - bio_for_each_segment_all(bvec, bio, iter_all) { - put_page(bvec->bv_page); - } + bio_release_pages(bio); bio_put(bio); return ERR_PTR(ret); } -- 2.20.1