Skip to contentSkip to conversation

nvme:Fix error handling in the function nvme_init_integrity

PATCH New Nicholas Krause 1 participant 1 message Aug 6, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme:Fix error handling in the function nvme_init_integrity

This fixes error handling in the function nvme_init_integrity by checking if the call to the function blck_integrity_register has failed by returning a error code and if so tell the user with dev_err that making this device integrity capable has failed before returning immediately to the caller of the function nvme_init_integriy as we cannot continue this function's work

Signed-off-by Nicholas Krause <xerofoify at gmail.com>
---
 drivers/block/nvme-core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/block/nvme-core.c +4 -1
index 7920c27..b4bff81 100644
@@ -572,7 +572,10 @@ static void nvme_init_integrity(struct nvme_ns *ns)
 		break;
 	}
 	integrity.tuple_size = ns->ms;
-	blk_integrity_register(ns->disk, &integrity);
+	if (blk_integrity_register(ns->disk, &integrity)) {
+		dev_err(ns->dev->device, "Failed to make this device integrity capable\n");
+		return;
+	}
 	blk_queue_max_integrity_segments(ns->queue, 1);
 }
 #else /* CONFIG_BLK_DEV_INTEGRITY */
Signature · 1 line
2.1.4