All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: weiping zhang <zhangweiping@didichuxing.com>
Cc: virtualization@lists.linux-foundation.org, mst@redhat.com
Subject: Re: [PATCH 3/3] virtio: put reference count of virtio_device.dev
Date: Tue, 12 Dec 2017 11:33:58 +0100	[thread overview]
Message-ID: <20171212113358.17ecfd7b.cohuck@redhat.com> (raw)
In-Reply-To: <f761f1f5a032b7233288bc6e6ae45e44867a31bc.1513007310.git.zhangweiping@didichuxing.com>

On Mon, 11 Dec 2017 23:55:38 +0800
weiping zhang <zhangweiping@didichuxing.com> wrote:

> rproc_virtio_dev_release will be called iff virtio_device.dev's
> refer count became to 0. Here we should put vdev.dev, and then
> rproc->dev's cleanup will be done in rproc_virtio_dev_release.
> 
> Signed-off-by: weiping zhang <zhangweiping@didichuxing.com>
> ---
>  drivers/remoteproc/remoteproc_virtio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
> index 2946348..b0633fd 100644
> --- a/drivers/remoteproc/remoteproc_virtio.c
> +++ b/drivers/remoteproc/remoteproc_virtio.c
> @@ -327,7 +327,7 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id)
>  
>  	ret = register_virtio_device(vdev);
>  	if (ret) {
> -		put_device(&rproc->dev);
> +		put_device(&vdev->dev);
>  		dev_err(dev, "failed to register vdev: %d\n", ret);
>  		goto out;
>  	}

Uh, rproc_vdev is really weird. It embeds a struct virtio_device, and
in addition a struct kref. At a glance, it seems to be correct, though.
Your change is more obviously sane.

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

      reply	other threads:[~2017-12-12 10:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 15:53 [PATCH 0/3] fix cleanup for fail to register_virtio_device weiping zhang
2017-12-11 15:55 ` [PATCH 1/3] virtio_pci: use put_device instead of kfree weiping zhang
2017-12-12 10:00   ` Cornelia Huck
2017-12-12 13:11     ` weiping zhang
2017-12-11 15:55 ` [PATCH 2/3] virtio: " weiping zhang
2017-12-12 10:17   ` Cornelia Huck
2017-12-12 13:13     ` weiping zhang
2017-12-11 15:55 ` [PATCH 3/3] virtio: put reference count of virtio_device.dev weiping zhang
2017-12-12 10:33   ` Cornelia Huck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171212113358.17ecfd7b.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=zhangweiping@didichuxing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.