powerpc/hvsi: Fix endianness issues in the HVSI driver
[firefly-linux-kernel-4.4.55.git] / drivers / block / nvme-core.c
index 22761a6c34aa6edeae71a38db5ced7260228664a..d1d6141920d3ced742d850b051d273d65aa3728e 100644 (file)
@@ -1171,12 +1171,13 @@ static int adapter_delete_sq(struct nvme_dev *dev, u16 sqid)
 
 int nvme_identify_ctrl(struct nvme_dev *dev, struct nvme_id_ctrl **id)
 {
-       struct nvme_command c = {
-               .identify.opcode = nvme_admin_identify,
-               .identify.cns = cpu_to_le32(1),
-       };
+       struct nvme_command c = { };
        int error;
 
+       /* gcc-4.4.4 (at least) has issues with initializers and anon unions */
+       c.identify.opcode = nvme_admin_identify;
+       c.identify.cns = cpu_to_le32(1);
+
        *id = kmalloc(sizeof(struct nvme_id_ctrl), GFP_KERNEL);
        if (!*id)
                return -ENOMEM;
@@ -1191,12 +1192,13 @@ int nvme_identify_ctrl(struct nvme_dev *dev, struct nvme_id_ctrl **id)
 int nvme_identify_ns(struct nvme_dev *dev, unsigned nsid,
                struct nvme_id_ns **id)
 {
-       struct nvme_command c = {
-               .identify.opcode = nvme_admin_identify,
-               .identify.nsid = cpu_to_le32(nsid),
-       };
+       struct nvme_command c = { };
        int error;
 
+       /* gcc-4.4.4 (at least) has issues with initializers and anon unions */
+       c.identify.opcode = nvme_admin_identify,
+       c.identify.nsid = cpu_to_le32(nsid),
+
        *id = kmalloc(sizeof(struct nvme_id_ns), GFP_KERNEL);
        if (!*id)
                return -ENOMEM;
@@ -1240,14 +1242,14 @@ int nvme_set_features(struct nvme_dev *dev, unsigned fid, unsigned dword11,
 
 int nvme_get_log_page(struct nvme_dev *dev, struct nvme_smart_log **log)
 {
-       struct nvme_command c = {
-               .common.opcode = nvme_admin_get_log_page,
-               .common.nsid = cpu_to_le32(0xFFFFFFFF),
-               .common.cdw10[0] = cpu_to_le32(
+       struct nvme_command c = { };
+       int error;
+
+       c.common.opcode = nvme_admin_get_log_page,
+       c.common.nsid = cpu_to_le32(0xFFFFFFFF),
+       c.common.cdw10[0] = cpu_to_le32(
                        (((sizeof(struct nvme_smart_log) / 4) - 1) << 16) |
                         NVME_LOG_SMART),
-       };
-       int error;
 
        *log = kmalloc(sizeof(struct nvme_smart_log), GFP_KERNEL);
        if (!*log)
@@ -1472,6 +1474,7 @@ static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid,
        nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride];
        nvmeq->q_depth = depth;
        nvmeq->qid = qid;
+       nvmeq->cq_vector = -1;
        dev->queues[qid] = nvmeq;
 
        /* make sure queue descriptor is set before queue count, for kthread */
@@ -1724,8 +1727,10 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev)
 
        nvmeq->cq_vector = 0;
        result = queue_request_irq(dev, nvmeq, nvmeq->irqname);
-       if (result)
+       if (result) {
+               nvmeq->cq_vector = -1;
                goto free_nvmeq;
+       }
 
        return result;
 
@@ -2211,8 +2216,10 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
        dev->max_qid = nr_io_queues;
 
        result = queue_request_irq(dev, adminq, adminq->irqname);
-       if (result)
+       if (result) {
+               adminq->cq_vector = -1;
                goto free_queues;
+       }
 
        /* Free previously allocated queues that are no longer usable */
        nvme_free_queues(dev, nr_io_queues + 1);
@@ -3124,8 +3131,8 @@ static void nvme_remove(struct pci_dev *pdev)
        flush_work(&dev->reset_work);
        flush_work(&dev->scan_work);
        device_remove_file(dev->device, &dev_attr_reset_controller);
-       nvme_dev_shutdown(dev);
        nvme_dev_remove(dev);
+       nvme_dev_shutdown(dev);
        nvme_dev_remove_admin(dev);
        device_destroy(nvme_class, MKDEV(nvme_char_major, dev->instance));
        nvme_free_queues(dev, 0);