All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rpmsg: virtio: Fix the unregistration of the device rpmsg_ctrl
@ 2022-04-22 15:54 Arnaud Pouliquen
  2022-04-24  2:06 ` Hangyu Hua
  0 siblings, 1 reply; 2+ messages in thread
From: Arnaud Pouliquen @ 2022-04-22 15:54 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier
  Cc: linux-remoteproc, linux-kernel, linux-stm32, arnaud.pouliquen,
	Hangyu Hua

Unregister the rpmsg_ctrl device instead of just freeing the
the virtio_rpmsg_channel structure.
This will properly unregister the device and call
virtio_rpmsg_release_device() that frees the structure.

Fixes: c486682ae1e2 ("rpmsg: virtio: Register the rpmsg_char device")

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Cc: Hangyu Hua <hbh25y@gmail.com>
---
 drivers/rpmsg/virtio_rpmsg_bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
index 3b7b47f785cf..0db8043e6c49 100644
--- a/drivers/rpmsg/virtio_rpmsg_bus.c
+++ b/drivers/rpmsg/virtio_rpmsg_bus.c
@@ -861,7 +861,7 @@ static void rpmsg_virtio_del_ctrl_dev(struct rpmsg_device *rpdev_ctrl)
 {
 	if (!rpdev_ctrl)
 		return;
-	kfree(to_virtio_rpmsg_channel(rpdev_ctrl));
+	device_unregister(&rpdev_ctrl->dev);
 }
 
 static int rpmsg_probe(struct virtio_device *vdev)
-- 
2.24.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rpmsg: virtio: Fix the unregistration of the device rpmsg_ctrl
  2022-04-22 15:54 [PATCH] rpmsg: virtio: Fix the unregistration of the device rpmsg_ctrl Arnaud Pouliquen
@ 2022-04-24  2:06 ` Hangyu Hua
  0 siblings, 0 replies; 2+ messages in thread
From: Hangyu Hua @ 2022-04-24  2:06 UTC (permalink / raw)
  To: Arnaud Pouliquen, Bjorn Andersson, Mathieu Poirier
  Cc: linux-remoteproc, linux-kernel, linux-stm32

On 2022/4/22 23:54, Arnaud Pouliquen wrote:
> Unregister the rpmsg_ctrl device instead of just freeing the
> the virtio_rpmsg_channel structure.
> This will properly unregister the device and call
> virtio_rpmsg_release_device() that frees the structure.
> 
> Fixes: c486682ae1e2 ("rpmsg: virtio: Register the rpmsg_char device")
> 
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
> Cc: Hangyu Hua <hbh25y@gmail.com>
> ---
>   drivers/rpmsg/virtio_rpmsg_bus.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
> index 3b7b47f785cf..0db8043e6c49 100644
> --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> @@ -861,7 +861,7 @@ static void rpmsg_virtio_del_ctrl_dev(struct rpmsg_device *rpdev_ctrl)
>   {
>   	if (!rpdev_ctrl)
>   		return;
> -	kfree(to_virtio_rpmsg_channel(rpdev_ctrl));
> +	device_unregister(&rpdev_ctrl->dev);
>   }
>   
>   static int rpmsg_probe(struct virtio_device *vdev)


Thanks for further optimization.

Reviewed-by: Hangyu Hua <hbh25y@gmail.com>

Thanks,
Hangyu

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-24  2:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22 15:54 [PATCH] rpmsg: virtio: Fix the unregistration of the device rpmsg_ctrl Arnaud Pouliquen
2022-04-24  2:06 ` Hangyu Hua

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.