Displaying 10 results from an estimated 10 matches for "virtio_register_device".
2017 Dec 19
1
[PATCH v3 5/5] virtio: add comments for virtio_register_device
...lt;zwp10758 at gmail.com> wrote:
> As mentioned at drivers/base/core.c:
> /*
> * NOTE: _Never_ directly free @dev after calling this function, even
> * if it returned an error! Always use put_device() to give up the
> * reference initialized in this function instead.
> */
> virtio_register_device may fail before/after call device_register, the
> caller should do a proper cleanup. Caller cann't use kfree directly,
> if virtio_register_device has already called device_register. Caller
> cann't use put_device directly, if virtio_register_device has not yet
> call device_reg...
2017 Dec 19
1
[PATCH v3 5/5] virtio: add comments for virtio_register_device
...lt;zwp10758 at gmail.com> wrote:
> As mentioned at drivers/base/core.c:
> /*
> * NOTE: _Never_ directly free @dev after calling this function, even
> * if it returned an error! Always use put_device() to give up the
> * reference initialized in this function instead.
> */
> virtio_register_device may fail before/after call device_register, the
> caller should do a proper cleanup. Caller cann't use kfree directly,
> if virtio_register_device has already called device_register. Caller
> cann't use put_device directly, if virtio_register_device has not yet
> call device_reg...
2017 Dec 17
0
[PATCH v3 5/5] virtio: add comments for virtio_register_device
As mentioned at drivers/base/core.c:
/*
* NOTE: _Never_ directly free @dev after calling this function, even
* if it returned an error! Always use put_device() to give up the
* reference initialized in this function instead.
*/
virtio_register_device may fail before/after call device_register, the
caller should do a proper cleanup. Caller cann't use kfree directly,
if virtio_register_device has already called device_register. Caller
cann't use put_device directly, if virtio_register_device has not yet
call device_register, because kobje...
2017 Dec 17
6
[PATCH v3 0/5] proper cleanup if fail to register_virtio_device
Hi,
Patch1 add a helper to get virtio_device's status which will be used
later.
Patch2~4: check virtio_device's status is RTIO_CONFIG_S_ACKNOWLEDGE
or not, if so use put_device otherwise use kfree.
Patch5: add comments for virtio_register_device help caller do a
proper cleanup if got failure.
weiping zhang (5):
virtio: add helper virtio_get_status
virtio_pci: don't kfree device on register failure
virtio_vop: don't kfree device on register failure
virtio_remoteproc: don't kfree device on register failure
virtio: add...
2017 Dec 17
6
[PATCH v3 0/5] proper cleanup if fail to register_virtio_device
Hi,
Patch1 add a helper to get virtio_device's status which will be used
later.
Patch2~4: check virtio_device's status is RTIO_CONFIG_S_ACKNOWLEDGE
or not, if so use put_device otherwise use kfree.
Patch5: add comments for virtio_register_device help caller do a
proper cleanup if got failure.
weiping zhang (5):
virtio: add helper virtio_get_status
virtio_pci: don't kfree device on register failure
virtio_vop: don't kfree device on register failure
virtio_remoteproc: don't kfree device on register failure
virtio: add...
2017 Dec 01
3
[PATCH] virtio: release virtio index when fail to device_register
...s?
Sorry to relay late and thanks for your review.
Do you mean the "extra reference to the struct device" caused by the
following code?
err = device_register(&dev->dev);
device_add(dev)
get_device(dev)
If I'm understand right, I think there is no extra reference if we fail
virtio_register_device, because if device_register we don't get a
reference.
--
Thanks
weiping
2017 Dec 01
3
[PATCH] virtio: release virtio index when fail to device_register
...s?
Sorry to relay late and thanks for your review.
Do you mean the "extra reference to the struct device" caused by the
following code?
err = device_register(&dev->dev);
device_add(dev)
get_device(dev)
If I'm understand right, I think there is no extra reference if we fail
virtio_register_device, because if device_register we don't get a
reference.
--
Thanks
weiping
2017 Dec 04
0
[PATCH] virtio: release virtio index when fail to device_register
...ur review.
> Do you mean the "extra reference to the struct device" caused by the
> following code?
>
> err = device_register(&dev->dev);
> device_add(dev)
> get_device(dev)
> If I'm understand right, I think there is no extra reference if we fail
> virtio_register_device, because if device_register we don't get a
> reference.
The device_initialize() already gives you a reference. If device_add()
fails, it has cleaned up any additional reference it might have
obtained, but the initial reference is still there and needs to be
released by the caller.
2017 Nov 29
3
[PATCH] virtio: release virtio index when fail to device_register
index can be reused by other virtio device.
Signed-off-by: weiping zhang <zhangweiping at didichuxing.com>
---
drivers/virtio/virtio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 48230a5..bf7ff39 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -333,6 +333,8 @@ int register_virtio_device(struct
2017 Nov 29
3
[PATCH] virtio: release virtio index when fail to device_register
index can be reused by other virtio device.
Signed-off-by: weiping zhang <zhangweiping at didichuxing.com>
---
drivers/virtio/virtio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 48230a5..bf7ff39 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -333,6 +333,8 @@ int register_virtio_device(struct