path: root/block/bio-integrity.c
diff options
authorKeith Busch <>2015-12-03 09:32:21 -0700
committerJens Axboe <>2015-12-03 09:32:21 -0700
commit06c1e3902aa74b7432a7e82bb4a5aca233a42839 (patch)
tree92372a5b1038eaa0ccbea92bf5f8625734ffd98f /block/bio-integrity.c
parent9a0be7abb62ff2a7dc3360ab45c31f29b3faf642 (diff)
blk-integrity: empty implementation when disabled
This patch moves the blk_integrity_payload definition outside the CONFIG_BLK_DEV_INTERITY dependency and provides empty function implementations when the kernel configuration disables integrity extensions. This simplifies drivers that make use of these to map user data so they don't need to repeat the same configuration checks. Signed-off-by: Keith Busch <> Updated by Jens to pass an error pointer return from bio_integrity_alloc(), otherwise if CONFIG_BLK_DEV_INTEGRITY isn't set, we return a weird ENOMEM from __nvme_submit_user_cmd() if a meta buffer is set. Signed-off-by: Jens Axboe <>
Diffstat (limited to 'block/bio-integrity.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index f6325d573c10..e6ba501eb746 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -66,7 +66,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
if (unlikely(!bip))
- return NULL;
+ return ERR_PTR(-ENOMEM);
memset(bip, 0, sizeof(*bip));
@@ -89,7 +89,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
return bip;
mempool_free(bip, bs->bio_integrity_pool);
- return NULL;
+ return ERR_PTR(-ENOMEM);