Skip to contentSkip to conversation

media: pci: mgb4: Fix return value check in debugfs_init()

PATCH In review Zhen Lei 2 participants 4 messages Oct 23, 2024 – Oct 24, 2024

Subsystems (2)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

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

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")
---
 drivers/media/pci/mgb4/mgb4_vin.c  | 2 +-
 drivers/media/pci/mgb4/mgb4_vout.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/mgb4/mgb4_vin.c +1 -1
index e9332abb31729ea..808eb51b270c755 100644
@@ -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";
drivers/media/pci/mgb4/mgb4_vout.c +1 -1
index 998edcbd972387d..348c8e01fcbed5a 100644
@@ -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";
Signature · 1 line
2.34.1
#1 lore raw
Quoted 28 lines · Zhen Lei

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")
---
  drivers/media/pci/mgb4/mgb4_vin.c  | 2 +-
  drivers/media/pci/mgb4/mgb4_vout.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/mgb4/mgb4_vin.c +1 -1
index e9332abb31729ea..808eb51b270c755 100644
@@ -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";
drivers/media/pci/mgb4/mgb4_vout.c +0 -0
index 998edcbd972387d..348c8e01fcbed5a 100644

drivers/media/pci/mgb4/mgb4_vout.c static void debugfs_init(struct mgb4_vout_dev *voutdev) · line 689

Quoted 8 lines
drivers/media/pci/mgb4/mgb4_vout.c +1 -1
@@ -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.

#2 lore raw
Quoted 28 lines · Martin Tůma
Quoted 27 lines · Zhen Lei

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")

---
  drivers/media/pci/mgb4/mgb4_vin.c  | 2 +-
  drivers/media/pci/mgb4/mgb4_vout.c | 2 +-

  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/mgb4/mgb4_vin.c +1 -1
index e9332abb31729ea..808eb51b270c755 100644
@@ -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";
drivers/media/pci/mgb4/mgb4_vout.c +0 -0
index 998edcbd972387d..348c8e01fcbed5a 100644
@@ -683,7 +683,7 @@ static void debugfs_init(struct mgb4_vout_dev 
 *voutdev)
Quoted 8 lines

drivers/media/pci/mgb4/mgb4_vout.c static void debugfs_init(struct mgb4_vout_dev *voutdev) · line 689

Quoted 6 lines
drivers/media/pci/mgb4/mgb4_vout.c +1 -1
       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

Quoted 5 lines

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.

#3 lore raw
Quoted 37 lines · Martin Tůma
Quoted 27 lines · Martin Tůma
Quoted 26 lines · Zhen Lei

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")

---
  drivers/media/pci/mgb4/mgb4_vin.c  | 2 +-
  drivers/media/pci/mgb4/mgb4_vout.c | 2 +-

  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/mgb4/mgb4_vin.c +1 -1
index e9332abb31729ea..808eb51b270c755 100644
@@ -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";
drivers/media/pci/mgb4/mgb4_vout.c +0 -0
index 998edcbd972387d..348c8e01fcbed5a 100644
@@ -683,7 +683,7 @@ static void debugfs_init(struct mgb4_vout_dev *voutdev)
Quoted 8 lines

drivers/media/pci/mgb4/mgb4_vout.c static void debugfs_init(struct mgb4_vout_dev *voutdev) · line 689

Quoted 6 lines
drivers/media/pci/mgb4/mgb4_vout.c +1 -1
       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:

Quoted 1 line

v4l2 media.git next branch

OK, I see it, thanks.

Quoted 9 lines
Quoted 6 lines

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.

.

Signature · 2 lines
Regards,
  Zhen Lei