2018-08-17 03:50:43

by zhong jiang

[permalink] [raw]
Subject: [PATCH] media: NULL check is meaningless before debugfs_remove_recursive

debugfs_remove_recursive has taken null pointer into account. so
remove the unneeded check.

Signed-off-by: zhong jiang <[email protected]>
---
drivers/media/usb/uvc/uvc_debugfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_debugfs.c b/drivers/media/usb/uvc/uvc_debugfs.c
index 368f8f8..6995aeb 100644
--- a/drivers/media/usb/uvc/uvc_debugfs.c
+++ b/drivers/media/usb/uvc/uvc_debugfs.c
@@ -128,6 +128,5 @@ void uvc_debugfs_init(void)

void uvc_debugfs_cleanup(void)
{
- if (uvc_debugfs_root_dir != NULL)
- debugfs_remove_recursive(uvc_debugfs_root_dir);
+ debugfs_remove_recursive(uvc_debugfs_root_dir);
}
--
1.7.12.4



2018-08-17 09:19:20

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH] media: NULL check is meaningless before debugfs_remove_recursive

Hi Zhong,

Thank you for the patch.

On Friday, 17 August 2018 06:37:26 EEST zhong jiang wrote:
> debugfs_remove_recursive has taken null pointer into account. so
> remove the unneeded check.
>
> Signed-off-by: zhong jiang <[email protected]>

I already have a similar patch in my tree (git://linuxtv.org/pinchartl/
media.git uvc/next) and will include it in my pull request for v4.20.

> ---
> drivers/media/usb/uvc/uvc_debugfs.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_debugfs.c
> b/drivers/media/usb/uvc/uvc_debugfs.c index 368f8f8..6995aeb 100644
> --- a/drivers/media/usb/uvc/uvc_debugfs.c
> +++ b/drivers/media/usb/uvc/uvc_debugfs.c
> @@ -128,6 +128,5 @@ void uvc_debugfs_init(void)
>
> void uvc_debugfs_cleanup(void)
> {
> - if (uvc_debugfs_root_dir != NULL)
> - debugfs_remove_recursive(uvc_debugfs_root_dir);
> + debugfs_remove_recursive(uvc_debugfs_root_dir);
> }

--
Regards,

Laurent Pinchart




2018-08-17 12:24:51

by zhong jiang

[permalink] [raw]
Subject: Re: [PATCH] media: NULL check is meaningless before debugfs_remove_recursive

On 2018/8/17 17:18, Laurent Pinchart wrote:
> Hi Zhong,
>
> Thank you for the patch.
>
> On Friday, 17 August 2018 06:37:26 EEST zhong jiang wrote:
>> debugfs_remove_recursive has taken null pointer into account. so
>> remove the unneeded check.
>>
>> Signed-off-by: zhong jiang <[email protected]>
> I already have a similar patch in my tree (git://linuxtv.org/pinchartl/
> media.git uvc/next) and will include it in my pull request for v4.20.
Thank you for let me know that. Maybe I miss that.

Sincerely,
zhong jiang
>> ---
>> drivers/media/usb/uvc/uvc_debugfs.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/usb/uvc/uvc_debugfs.c
>> b/drivers/media/usb/uvc/uvc_debugfs.c index 368f8f8..6995aeb 100644
>> --- a/drivers/media/usb/uvc/uvc_debugfs.c
>> +++ b/drivers/media/usb/uvc/uvc_debugfs.c
>> @@ -128,6 +128,5 @@ void uvc_debugfs_init(void)
>>
>> void uvc_debugfs_cleanup(void)
>> {
>> - if (uvc_debugfs_root_dir != NULL)
>> - debugfs_remove_recursive(uvc_debugfs_root_dir);
>> + debugfs_remove_recursive(uvc_debugfs_root_dir);
>> }