Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1420858 > unrolled thread

Re: [PATCH] media: s5p-mfc fix memory leak in s5p_mfc_remove()

Started byJavier Martinez Canillas <javier@dowhile0.org>
First post2016-06-13 15:50 +0200
Last post2016-06-13 17:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] media: s5p-mfc fix memory leak in s5p_mfc_remove() Javier Martinez Canillas <javier@dowhile0.org> - 2016-06-13 15:50 +0200
    Re: [PATCH] media: s5p-mfc fix memory leak in s5p_mfc_remove() Shuah Khan <shuahkh@osg.samsung.com> - 2016-06-13 17:40 +0200

#1420858 — Re: [PATCH] media: s5p-mfc fix memory leak in s5p_mfc_remove()

FromJavier Martinez Canillas <javier@dowhile0.org>
Date2016-06-13 15:50 +0200
SubjectRe: [PATCH] media: s5p-mfc fix memory leak in s5p_mfc_remove()
Message-ID<rJApA-6Xi-23@gated-at.bofh.it>
Hello Shuah,

On Wed, Jun 8, 2016 at 9:35 PM, Shuah Khan <shuahkh@osg.samsung.com> wrote:
> s5p_mfc_remove() fails to release encoder and decoder video devices.
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> index 274b4f1..af61f54 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> @@ -1317,7 +1317,9 @@ static int s5p_mfc_remove(struct platform_device *pdev)
>         destroy_workqueue(dev->watchdog_workqueue);
>
>         video_unregister_device(dev->vfd_enc);
> +       video_device_release(dev->vfd_enc);
>         video_unregister_device(dev->vfd_dec);
> +       video_device_release(dev->vfd_dec);
>         v4l2_device_unregister(&dev->v4l2_dev);
>         s5p_mfc_release_firmware(dev);
>         vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]);
> --

Can you please do the remove operations in the inverse order of their
counterparts? IOW to do the release for both encoder and decoder after
their unregistration.

After that change:

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
Javier

[toc] | [next] | [standalone]


#1421003

FromShuah Khan <shuahkh@osg.samsung.com>
Date2016-06-13 17:40 +0200
Message-ID<rJC81-8aA-5@gated-at.bofh.it>
In reply to#1420858
On 06/13/2016 07:42 AM, Javier Martinez Canillas wrote:
> Hello Shuah,
> 
> On Wed, Jun 8, 2016 at 9:35 PM, Shuah Khan <shuahkh@osg.samsung.com> wrote:
>> s5p_mfc_remove() fails to release encoder and decoder video devices.
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>>  drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
>> index 274b4f1..af61f54 100644
>> --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
>> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
>> @@ -1317,7 +1317,9 @@ static int s5p_mfc_remove(struct platform_device *pdev)
>>         destroy_workqueue(dev->watchdog_workqueue);
>>
>>         video_unregister_device(dev->vfd_enc);
>> +       video_device_release(dev->vfd_enc);
>>         video_unregister_device(dev->vfd_dec);
>> +       video_device_release(dev->vfd_dec);
>>         v4l2_device_unregister(&dev->v4l2_dev);
>>         s5p_mfc_release_firmware(dev);
>>         vb2_dma_contig_cleanup_ctx(dev->alloc_ctx[0]);
>> --
> 
> Can you please do the remove operations in the inverse order of their
> counterparts? IOW to do the release for both encoder and decoder after
> their unregistration.
> 

I considered that. No problem. I will move both release after the
video_unregister_device(dev->vfd_dec), releasing enc first and then
the dec

> 
> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
> 

thanks,
-- Shuah

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web