summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2015-12-03 17:32:21 +0100
committerJens Axboe <axboe@fb.com>2015-12-03 17:32:21 +0100
commit06c1e3902aa74b7432a7e82bb4a5aca233a42839 (patch)
tree92372a5b1038eaa0ccbea92bf5f8625734ffd98f /drivers
parentnvme: refactor set_queue_count (diff)
downloadlinux-06c1e3902aa74b7432a7e82bb4a5aca233a42839.tar.xz
linux-06c1e3902aa74b7432a7e82bb4a5aca233a42839.zip
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 <keith.busch@intel.com> 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 <axboe@fb.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvme/host/core.c4
-rw-r--r--drivers/target/target_core_iblock.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index c61bde9921d2..f9c4e80c2441 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -190,8 +190,8 @@ int __nvme_submit_user_cmd(struct request_queue *q, struct nvme_command *cmd,
}
bip = bio_integrity_alloc(bio, GFP_KERNEL, 1);
- if (!bip) {
- ret = -ENOMEM;
+ if (IS_ERR(bip)) {
+ ret = PTR_ERR(bip);
goto out_free_meta;
}
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index f29c69120054..d5891b6ea737 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -613,9 +613,9 @@ iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio)
}
bip = bio_integrity_alloc(bio, GFP_NOIO, cmd->t_prot_nents);
- if (!bip) {
+ if (IS_ERR(bip)) {
pr_err("Unable to allocate bio_integrity_payload\n");
- return -ENOMEM;
+ return PTR_ERR(bip);
}
bip->bip_iter.bi_size = (cmd->data_length / dev->dev_attrib.block_size) *