* [PATCH] virtio_mmio: Set dev.release() to avoid warning
@ 2016-11-24 0:31 Yuan Liu
2016-11-25 2:37 ` Jason Wang
0 siblings, 1 reply; 4+ messages in thread
From: Yuan Liu @ 2016-11-24 0:31 UTC (permalink / raw)
To: mst, jasowang; +Cc: Yuan Liu, virtualization
From: Yuan Liu <liuyuan@google.com>
Fix a warning thrown from virtio_mmio_remove():
Device 'virtio0' does not have a release() function
The fix is according to virtio_pci_probe() of
drivers/virtio/virtio_pci_common.c
Signed-off-by: Yuan Liu <liuyuan@google.com>
---
drivers/virtio/virtio_mmio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 48bfea9..d47a2fc 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -489,6 +489,7 @@ static const struct virtio_config_ops virtio_mmio_config_ops = {
};
+static void virtio_mmio_release_dev_empty(struct device *_d) {}
/* Platform device */
@@ -511,6 +512,7 @@ static int virtio_mmio_probe(struct platform_device *pdev)
return -ENOMEM;
vm_dev->vdev.dev.parent = &pdev->dev;
+ vm_dev->vdev.dev.release = virtio_mmio_release_dev_empty;
vm_dev->vdev.config = &virtio_mmio_config_ops;
vm_dev->pdev = pdev;
INIT_LIST_HEAD(&vm_dev->virtqueues);
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio_mmio: Set dev.release() to avoid warning
2016-11-24 0:31 [PATCH] virtio_mmio: Set dev.release() to avoid warning Yuan Liu
@ 2016-11-25 2:37 ` Jason Wang
2016-11-25 2:47 ` Yuan Liu
0 siblings, 1 reply; 4+ messages in thread
From: Jason Wang @ 2016-11-25 2:37 UTC (permalink / raw)
To: Yuan Liu, mst; +Cc: Yuan Liu, virtualization
On 2016年11月24日 08:31, Yuan Liu wrote:
> From: Yuan Liu <liuyuan@google.com>
>
> Fix a warning thrown from virtio_mmio_remove():
> Device 'virtio0' does not have a release() function
>
> The fix is according to virtio_pci_probe() of
> drivers/virtio/virtio_pci_common.c
>
> Signed-off-by: Yuan Liu <liuyuan@google.com>
> ---
> drivers/virtio/virtio_mmio.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> index 48bfea9..d47a2fc 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -489,6 +489,7 @@ static const struct virtio_config_ops virtio_mmio_config_ops = {
> };
>
>
> +static void virtio_mmio_release_dev_empty(struct device *_d) {}
Do we need to free vm_dev here?
>
> /* Platform device */
>
> @@ -511,6 +512,7 @@ static int virtio_mmio_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> vm_dev->vdev.dev.parent = &pdev->dev;
> + vm_dev->vdev.dev.release = virtio_mmio_release_dev_empty;
> vm_dev->vdev.config = &virtio_mmio_config_ops;
> vm_dev->pdev = pdev;
> INIT_LIST_HEAD(&vm_dev->virtqueues);
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio_mmio: Set dev.release() to avoid warning
2016-11-25 2:37 ` Jason Wang
@ 2016-11-25 2:47 ` Yuan Liu
2016-11-25 2:51 ` Jason Wang
0 siblings, 1 reply; 4+ messages in thread
From: Yuan Liu @ 2016-11-25 2:47 UTC (permalink / raw)
To: Jason Wang; +Cc: virtualization, Yuan Liu, mst
[-- Attachment #1.1: Type: text/plain, Size: 1589 bytes --]
I think not. In virtio_pci_common, vp_dev is allocated by kzalloc so a
kfree is needed. Here vm_dev is allocated by devm_kmalloc which is
"automatically freed on driver detach" from the comment
(drivers/base/devres.c:769).
On Thu, Nov 24, 2016 at 6:37 PM, Jason Wang <jasowang@redhat.com> wrote:
>
>
> On 2016年11月24日 08:31, Yuan Liu wrote:
>
>> From: Yuan Liu <liuyuan@google.com>
>>
>> Fix a warning thrown from virtio_mmio_remove():
>> Device 'virtio0' does not have a release() function
>>
>> The fix is according to virtio_pci_probe() of
>> drivers/virtio/virtio_pci_common.c
>>
>> Signed-off-by: Yuan Liu <liuyuan@google.com>
>> ---
>> drivers/virtio/virtio_mmio.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
>> index 48bfea9..d47a2fc 100644
>> --- a/drivers/virtio/virtio_mmio.c
>> +++ b/drivers/virtio/virtio_mmio.c
>> @@ -489,6 +489,7 @@ static const struct virtio_config_ops
>> virtio_mmio_config_ops = {
>> };
>> +static void virtio_mmio_release_dev_empty(struct device *_d) {}
>>
>
> Do we need to free vm_dev here?
>
>
> /* Platform device */
>> @@ -511,6 +512,7 @@ static int virtio_mmio_probe(struct platform_device
>> *pdev)
>> return -ENOMEM;
>> vm_dev->vdev.dev.parent = &pdev->dev;
>> + vm_dev->vdev.dev.release = virtio_mmio_release_dev_empty;
>> vm_dev->vdev.config = &virtio_mmio_config_ops;
>> vm_dev->pdev = pdev;
>> INIT_LIST_HEAD(&vm_dev->virtqueues);
>>
>
>
[-- Attachment #1.2: Type: text/html, Size: 2439 bytes --]
[-- Attachment #2: Type: text/plain, Size: 183 bytes --]
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio_mmio: Set dev.release() to avoid warning
2016-11-25 2:47 ` Yuan Liu
@ 2016-11-25 2:51 ` Jason Wang
0 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2016-11-25 2:51 UTC (permalink / raw)
To: Yuan Liu; +Cc: virtualization, Yuan Liu, mst
On 2016年11月25日 10:47, Yuan Liu wrote:
> I think not. In virtio_pci_common, vp_dev is allocated by kzalloc so a
> kfree is needed. Here vm_dev is allocated by devm_kmalloc which is
> "automatically freed on driver detach" from the comment
> (drivers/base/devres.c:769).
I see, thanks.
Reviewed-by: Jason Wang <jasowang@redhat.com>
>
> On Thu, Nov 24, 2016 at 6:37 PM, Jason Wang <jasowang@redhat.com
> <mailto:jasowang@redhat.com>> wrote:
>
>
>
> On 2016年11月24日 08:31, Yuan Liu wrote:
>
> From: Yuan Liu <liuyuan@google.com <mailto:liuyuan@google.com>>
>
> Fix a warning thrown from virtio_mmio_remove():
> Device 'virtio0' does not have a release() function
>
> The fix is according to virtio_pci_probe() of
> drivers/virtio/virtio_pci_common.c
>
> Signed-off-by: Yuan Liu <liuyuan@google.com
> <mailto:liuyuan@google.com>>
> ---
> drivers/virtio/virtio_mmio.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/virtio/virtio_mmio.c
> b/drivers/virtio/virtio_mmio.c
> index 48bfea9..d47a2fc 100644
> --- a/drivers/virtio/virtio_mmio.c
> +++ b/drivers/virtio/virtio_mmio.c
> @@ -489,6 +489,7 @@ static const struct virtio_config_ops
> virtio_mmio_config_ops = {
> };
> +static void virtio_mmio_release_dev_empty(struct device
> *_d) {}
>
>
> Do we need to free vm_dev here?
>
>
> /* Platform device */
> @@ -511,6 +512,7 @@ static int virtio_mmio_probe(struct
> platform_device *pdev)
> return -ENOMEM;
> vm_dev->vdev.dev.parent = &pdev->dev;
> + vm_dev->vdev.dev.release = virtio_mmio_release_dev_empty;
> vm_dev->vdev.config = &virtio_mmio_config_ops;
> vm_dev->pdev = pdev;
> INIT_LIST_HEAD(&vm_dev->virtqueues);
>
>
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-25 2:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24 0:31 [PATCH] virtio_mmio: Set dev.release() to avoid warning Yuan Liu
2016-11-25 2:37 ` Jason Wang
2016-11-25 2:47 ` Yuan Liu
2016-11-25 2:51 ` Jason Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).