sector_t end_sect;
req_sects = min(req_sects, bio_allowed_max_sectors(q));
+ if (!req_sects)
+ goto fail;
end_sect = sector + req_sects;
*biop = bio;
return 0;
+
+fail:
+ if (bio) {
+ submit_bio_wait(bio);
+ bio_put(bio);
+ }
+ *biop = NULL;
+ return -EOPNOTSUPP;
}
EXPORT_SYMBOL(__blkdev_issue_discard);