]> git.baikalelectronics.ru Git - uboot.git/commitdiff
nvme: Fix warning of cast from pointer to integer of different size
authorBin Meng <bmeng.cn@gmail.com>
Wed, 15 May 2019 15:37:56 +0000 (08:37 -0700)
committerBin Meng <bmeng.cn@gmail.com>
Sun, 19 May 2019 08:17:33 +0000 (16:17 +0800)
When dma_addr_t is u32 in 64-bit, there are some warnings when
building NVME driver. Fix it by doing an additional (long) cast.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
drivers/nvme/nvme.c
drivers/nvme/nvme_show.c

index 1ee0a0aefb14e350d878e2237a29962af57d6834..d4965e2ef635984da967f06967ab30846ec00e17 100644 (file)
@@ -577,7 +577,7 @@ static int nvme_get_info_from_identify(struct nvme_dev *dev)
        int ret;
        int shift = NVME_CAP_MPSMIN(dev->cap) + 12;
 
-       ret = nvme_identify(dev, 0, 1, (dma_addr_t)ctrl);
+       ret = nvme_identify(dev, 0, 1, (dma_addr_t)(long)ctrl);
        if (ret)
                return -EIO;
 
@@ -646,7 +646,7 @@ static int nvme_blk_probe(struct udevice *udev)
        ns->dev = ndev;
        /* extract the namespace id from the block device name */
        ns->ns_id = trailing_strtol(udev->name) + 1;
-       if (nvme_identify(ndev, ns->ns_id, 0, (dma_addr_t)id))
+       if (nvme_identify(ndev, ns->ns_id, 0, (dma_addr_t)(long)id))
                return -EIO;
 
        flbas = id->flbas & NVME_NS_FLBAS_LBA_MASK;
index 395b0618e6448d87947dd766f173d31ce3fe4436..15e459da1acd4eb5e23005f461479fc51ca0d82c 100644 (file)
@@ -111,14 +111,14 @@ int nvme_print_info(struct udevice *udev)
        ALLOC_CACHE_ALIGN_BUFFER(char, buf_ctrl, sizeof(struct nvme_id_ctrl));
        struct nvme_id_ctrl *ctrl = (struct nvme_id_ctrl *)buf_ctrl;
 
-       if (nvme_identify(dev, 0, 1, (dma_addr_t)ctrl))
+       if (nvme_identify(dev, 0, 1, (dma_addr_t)(long)ctrl))
                return -EIO;
 
        print_optional_admin_cmd(le16_to_cpu(ctrl->oacs), ns->devnum);
        print_optional_nvm_cmd(le16_to_cpu(ctrl->oncs), ns->devnum);
        print_format_nvme_attributes(ctrl->fna, ns->devnum);
 
-       if (nvme_identify(dev, ns->ns_id, 0, (dma_addr_t)id))
+       if (nvme_identify(dev, ns->ns_id, 0, (dma_addr_t)(long)id))
                return -EIO;
 
        print_formats(id, ns);