diff mbox series

[1/1] media: pci: mgb4: Fix return value check in debugfs_init()

Message ID 20241023063638.241-1-thunder.leizhen@huawei.com (mailing list archive)
State New
Headers show
Series [1/1] media: pci: mgb4: Fix return value check in debugfs_init() | expand

Commit Message

Zhen Lei Oct. 23, 2024, 6:36 a.m. UTC
Fix the incorrect return value check for debugfs_create_dir(), which
returns ERR_PTR(-ERROR) instead of NULL when it fails.

Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver")
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/media/pci/mgb4/mgb4_vin.c  | 2 +-
 drivers/media/pci/mgb4/mgb4_vout.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Martin Tůma Oct. 23, 2024, 9:04 a.m. UTC | #1
On 23. 10. 24 8:36, Zhen Lei wrote:
> Fix the incorrect return value check for debugfs_create_dir(), which
> returns ERR_PTR(-ERROR) instead of NULL when it fails.
> 
> Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver")
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
> ---
>   drivers/media/pci/mgb4/mgb4_vin.c  | 2 +-
>   drivers/media/pci/mgb4/mgb4_vout.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/mgb4/mgb4_vin.c
> index e9332abb31729ea..808eb51b270c755 100644
> --- a/drivers/media/pci/mgb4/mgb4_vin.c
> +++ b/drivers/media/pci/mgb4/mgb4_vin.c
> @@ -860,7 +860,7 @@ static void debugfs_init(struct mgb4_vin_dev *vindev)
>   
>   	vindev->debugfs = debugfs_create_dir(vindev->vdev.name,
>   					     vindev->mgbdev->debugfs);
> -	if (!vindev->debugfs)
> +	if (IS_ERR(vindev->debugfs))
>   		return;
>   
>   	vindev->regs[0].name = "CONFIG";
> diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/mgb4/mgb4_vout.c
> index 998edcbd972387d..348c8e01fcbed5a 100644
> --- a/drivers/media/pci/mgb4/mgb4_vout.c
> +++ b/drivers/media/pci/mgb4/mgb4_vout.c
> @@ -683,7 +683,7 @@ static void debugfs_init(struct mgb4_vout_dev *voutdev)
>   
>   	voutdev->debugfs = debugfs_create_dir(voutdev->vdev.name,
>   					      voutdev->mgbdev->debugfs);
> -	if (!voutdev->debugfs)
> +	if (IS_ERR(voutdev->debugfs))
>   		return;
>   
>   	voutdev->regs[0].name = "CONFIG";

This issue has already been addressed and fixed, see the v4l2 media.git 
branch:

https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vin.c 
https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vout.c

M.
Martin Tůma Oct. 23, 2024, 9:18 a.m. UTC | #2
On 23. 10. 24 11:04, Martin Tůma wrote:
> On 23. 10. 24 8:36, Zhen Lei wrote:
>> Fix the incorrect return value check for debugfs_create_dir(), which
>> returns ERR_PTR(-ERROR) instead of NULL when it fails.
>>
>> Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 
>> driver")
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>> ---
>>   drivers/media/pci/mgb4/mgb4_vin.c  | 2 +-
>>   drivers/media/pci/mgb4/mgb4_vout.c | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/ 
>> mgb4/mgb4_vin.c
>> index e9332abb31729ea..808eb51b270c755 100644
>> --- a/drivers/media/pci/mgb4/mgb4_vin.c
>> +++ b/drivers/media/pci/mgb4/mgb4_vin.c
>> @@ -860,7 +860,7 @@ static void debugfs_init(struct mgb4_vin_dev *vindev)
>>       vindev->debugfs = debugfs_create_dir(vindev->vdev.name,
>>                            vindev->mgbdev->debugfs);
>> -    if (!vindev->debugfs)
>> +    if (IS_ERR(vindev->debugfs))
>>           return;
>>       vindev->regs[0].name = "CONFIG";
>> diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/ 
>> mgb4/mgb4_vout.c
>> index 998edcbd972387d..348c8e01fcbed5a 100644
>> --- a/drivers/media/pci/mgb4/mgb4_vout.c
>> +++ b/drivers/media/pci/mgb4/mgb4_vout.c
>> @@ -683,7 +683,7 @@ static void debugfs_init(struct mgb4_vout_dev 
>> *voutdev)
>>       voutdev->debugfs = debugfs_create_dir(voutdev->vdev.name,
>>                             voutdev->mgbdev->debugfs);
>> -    if (!voutdev->debugfs)
>> +    if (IS_ERR(voutdev->debugfs))
>>           return;
>>       voutdev->regs[0].name = "CONFIG";
> 
> This issue has already been addressed and fixed, see the v4l2 media.git 
> branch:

v4l2 media.git next branch

> 
> https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vin.c 
> https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vout.c
> 
> M.
>
Zhen Lei Oct. 24, 2024, 1:15 a.m. UTC | #3
On 2024/10/23 17:18, Martin Tůma wrote:
> On 23. 10. 24 11:04, Martin Tůma wrote:
>> On 23. 10. 24 8:36, Zhen Lei wrote:
>>> Fix the incorrect return value check for debugfs_create_dir(), which
>>> returns ERR_PTR(-ERROR) instead of NULL when it fails.
>>>
>>> Fixes: 0ab13674a9bd ("media: pci: mgb4: Added Digiteq Automotive MGB4 driver")
>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>> ---
>>>   drivers/media/pci/mgb4/mgb4_vin.c  | 2 +-
>>>   drivers/media/pci/mgb4/mgb4_vout.c | 2 +-
>>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/ mgb4/mgb4_vin.c
>>> index e9332abb31729ea..808eb51b270c755 100644
>>> --- a/drivers/media/pci/mgb4/mgb4_vin.c
>>> +++ b/drivers/media/pci/mgb4/mgb4_vin.c
>>> @@ -860,7 +860,7 @@ static void debugfs_init(struct mgb4_vin_dev *vindev)
>>>       vindev->debugfs = debugfs_create_dir(vindev->vdev.name,
>>>                            vindev->mgbdev->debugfs);
>>> -    if (!vindev->debugfs)
>>> +    if (IS_ERR(vindev->debugfs))
>>>           return;
>>>       vindev->regs[0].name = "CONFIG";
>>> diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/ mgb4/mgb4_vout.c
>>> index 998edcbd972387d..348c8e01fcbed5a 100644
>>> --- a/drivers/media/pci/mgb4/mgb4_vout.c
>>> +++ b/drivers/media/pci/mgb4/mgb4_vout.c
>>> @@ -683,7 +683,7 @@ static void debugfs_init(struct mgb4_vout_dev *voutdev)
>>>       voutdev->debugfs = debugfs_create_dir(voutdev->vdev.name,
>>>                             voutdev->mgbdev->debugfs);
>>> -    if (!voutdev->debugfs)
>>> +    if (IS_ERR(voutdev->debugfs))
>>>           return;
>>>       voutdev->regs[0].name = "CONFIG";
>>
>> This issue has already been addressed and fixed, see the v4l2 media.git branch:
> 
> v4l2 media.git next branch

OK, I see it, thanks.

> 
>>
>> https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vin.c https://git.linuxtv.org/media.git/tree/drivers/media/pci/mgb4/mgb4_vout.c
>>
>> M.
>>
> 
> .
>
diff mbox series

Patch

diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/mgb4/mgb4_vin.c
index e9332abb31729ea..808eb51b270c755 100644
--- a/drivers/media/pci/mgb4/mgb4_vin.c
+++ b/drivers/media/pci/mgb4/mgb4_vin.c
@@ -860,7 +860,7 @@  static void debugfs_init(struct mgb4_vin_dev *vindev)
 
 	vindev->debugfs = debugfs_create_dir(vindev->vdev.name,
 					     vindev->mgbdev->debugfs);
-	if (!vindev->debugfs)
+	if (IS_ERR(vindev->debugfs))
 		return;
 
 	vindev->regs[0].name = "CONFIG";
diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/mgb4/mgb4_vout.c
index 998edcbd972387d..348c8e01fcbed5a 100644
--- a/drivers/media/pci/mgb4/mgb4_vout.c
+++ b/drivers/media/pci/mgb4/mgb4_vout.c
@@ -683,7 +683,7 @@  static void debugfs_init(struct mgb4_vout_dev *voutdev)
 
 	voutdev->debugfs = debugfs_create_dir(voutdev->vdev.name,
 					      voutdev->mgbdev->debugfs);
-	if (!voutdev->debugfs)
+	if (IS_ERR(voutdev->debugfs))
 		return;
 
 	voutdev->regs[0].name = "CONFIG";