nvme-rdma: fix error code in nvme_rdma_create_ctrl()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 14 Jun 2017 10:46:45 +0000 (13:46 +0300)
committerChristoph Hellwig <hch@lst.de>
Thu, 15 Jun 2017 12:30:28 +0000 (14:30 +0200)
We accidentally return ERR_PTR(0) which is NULL.  The caller isn't
explicitly checking for that but I couldn't immediately spot whether
this would lead to a NULL dereference.  Anyway, we can fix add an
error code easily enough.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/rdma.c

index 2c714f8266bc8a341bf3ba09c58bae3332df4e17..fd4359e6f40badabee113b2deec2724ecbb6a5a0 100644 (file)
@@ -1919,12 +1919,14 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
        /* sanity check icdoff */
        if (ctrl->ctrl.icdoff) {
                dev_err(ctrl->ctrl.device, "icdoff is not supported!\n");
+               ret = -EINVAL;
                goto out_remove_admin_queue;
        }
 
        /* sanity check keyed sgls */
        if (!(ctrl->ctrl.sgls & (1 << 20))) {
                dev_err(ctrl->ctrl.device, "Mandatory keyed sgls are not support\n");
+               ret = -EINVAL;
                goto out_remove_admin_queue;
        }