[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2842e634-bb92-a901-0a64-35a4dcde22da@redhat.com>
Date: Thu, 5 Mar 2020 11:01:43 +0800
From: Jason Wang <jasowang@...hat.com>
To: Jason Gunthorpe <jgg@...lanox.com>
Cc: mst@...hat.com, linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
tiwei.bie@...el.com, maxime.coquelin@...hat.com,
cunming.liang@...el.com, zhihong.wang@...el.com,
rob.miller@...adcom.com, xiao.w.wang@...el.com,
haotian.wang@...ive.com, lingshan.zhu@...el.com,
eperezma@...hat.com, lulu@...hat.com, parav@...lanox.com,
kevin.tian@...el.com, stefanha@...hat.com, rdunlap@...radead.org,
hch@...radead.org, aadam@...hat.com, jiri@...lanox.com,
shahafs@...lanox.com, hanand@...inx.com, mhabets@...arflare.com,
gdawar@...inx.com, saugatm@...inx.com, vmireyno@...vell.com
Subject: Re: [PATCH V5 3/5] vDPA: introduce vDPA bus
On 2020/3/5 上午3:29, Jason Gunthorpe wrote:
> On Wed, Feb 26, 2020 at 02:04:54PM +0800, Jason Wang wrote:
>> +struct vdpa_device *vdpa_alloc_device(struct device *parent,
>> + struct device *dma_dev,
>> + const struct vdpa_config_ops *config)
>> +{
>> + struct vdpa_device *vdev;
>> + int err = -ENOMEM;
>> +
>> + if (!parent || !dma_dev || !config)
>> + goto err;
>> +
>> + vdev = kzalloc(sizeof(*vdev), GFP_KERNEL);
>> + if (!vdev)
>> + goto err;
>> +
>> + err = ida_simple_get(&vdpa_index_ida, 0, 0, GFP_KERNEL);
>> + if (err < 0)
>> + goto err_ida;
>> +
>> + vdev->dev.bus = &vdpa_bus;
>> + vdev->dev.parent = parent;
>> + vdev->dev.release = vdpa_release_dev;
>> +
>> + device_initialize(&vdev->dev);
>> +
>> + vdev->index = err;
>> + vdev->dma_dev = dma_dev;
>> + vdev->config = config;
>> +
>> + dev_set_name(&vdev->dev, "vdpa%u", vdev->index);
> Probably shouldn't ignore the error for dev_set_name ?
>
> err = dev_set_name()
> if (err) {
> put_device(&vdev->dev);
> return ERR_PTR(err);
> }
>
> Jason
>
Right, will fix.
Thanks
Powered by blists - more mailing lists