Skip to content

Commit

Permalink
media: nuvoton: Fix an error check in npcm_video_ece_init()
Browse files Browse the repository at this point in the history
When function of_find_device_by_node() fails, it returns NULL instead of
an error code. So the corresponding error check logic should be modified
to check whether the return value is NULL and set the error code to be
returned as -ENODEV.

Fixes: 46c15a4 ("media: nuvoton: Add driver for NPCM video capture and encoding engine")
Cc: stable@vger.kernel.org
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20241015014053.669-1-thunder.leizhen@huawei.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
Zhen Lei authored and Mauro Carvalho Chehab committed Jan 8, 2025
1 parent c36b9ad commit c4b7779
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/platform/nuvoton/npcm-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1665,9 +1665,9 @@ static int npcm_video_ece_init(struct npcm_video *video)
dev_info(dev, "Support HEXTILE pixel format\n");

ece_pdev = of_find_device_by_node(ece_node);
if (IS_ERR(ece_pdev)) {
if (!ece_pdev) {
dev_err(dev, "Failed to find ECE device\n");
return PTR_ERR(ece_pdev);
return -ENODEV;
}
of_node_put(ece_node);

Expand Down

0 comments on commit c4b7779

Please sign in to comment.