Skip to contentSkip to conversation

media: nuvoton: npcm-video: Fix IS_ERR() vs NULL bug

PATCH In review Dan Carpenter 2 participants 4 messages Sep 27, 2023 – Oct 3, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: nuvoton: npcm-video: Fix IS_ERR() vs NULL bug

The of_parse_phandle() function returns NULL on error. It never returns error pointers. Update the check accordingly.

Fixes 70721089985c ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
---
 drivers/media/platform/nuvoton/npcm-video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/nuvoton/npcm-video.c +2 -2
index ac8d73b794d3..b9e6782f59b4 100644
@@ -1660,9 +1660,9 @@ static int npcm_video_ece_init(struct npcm_video *video)
 	void __iomem *regs;
 
 	ece_node = of_parse_phandle(video->dev->of_node, "nuvoton,ece", 0);
-	if (IS_ERR(ece_node)) {
+	if (!ece_node) {
 		dev_err(dev, "Failed to get ECE phandle in DTS\n");
-		return PTR_ERR(ece_node);
+		return -ENODEV;
 	}
 
 	video->ece.enable = of_device_is_available(ece_node);
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw

Hi Dan,

Thanks for the patch.

Quoted 2 lines

The of_parse_phandle() function returns NULL on error. It never returns error pointers. Update the check accordingly.

Commit message contains some redundant whitespaces.

Quoted 13 lines
Fixes 70721089985c ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
---
 drivers/media/platform/nuvoton/npcm-video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/nuvoton/npcm-video.c +0 -0
index ac8d73b794d3..b9e6782f59b4 100644
@@ -1660,9 +1660,9 @@ static int npcm_video_ece_init(struct npcm_video *video)
        void __iomem *regs;

drivers/media/platform/nuvoton/npcm-video.c static int npcm_video_ece_init(struct npcm_video *video) · line 1668

Quoted 10 lines
drivers/media/platform/nuvoton/npcm-video.c +2 -2
 
        ece_node = of_parse_phandle(video->dev->of_node, "nuvoton,ece", 0);
-       if (IS_ERR(ece_node)) {
+       if (!ece_node) {
                dev_err(dev, "Failed to get ECE phandle in DTS\n");
-               return PTR_ERR(ece_node);
+               return -ENODEV;
        }
 
        video->ece.enable = of_device_is_available(ece_node);

Others,

Regards,
Marvin

#2 lore raw
Quoted 9 lines · Kun-Fa Lin

Hi Dan,

Thanks for the patch.

Quoted 2 lines

The of_parse_phandle() function returns NULL on error. It never returns error pointers. Update the check accordingly.

Commit message contains some redundant whitespaces.

I have no idea what you're talking about? Are you talking about two spaces after a period? :P

regards,
dan carpenter

#3 lore raw
Quoted 6 lines · Kun-Fa Lin
Quoted 5 lines

Hi Dan,

Thanks for the patch.

Quoted 1 line

The of_parse_phandle() function returns NULL on error. It never returns

                          ^^
Quoted 1 line
Quoted 1 line
Quoted 1 line

error pointers. Update the check accordingly.

                               ^^
Quoted 7 lines
Quoted 3 lines

Commit message contains some redundant whitespaces.

I have no idea what you're talking about? Are you talking about two spaces after a period? :P

Yes :P

Regards,
Marvin