Skip to content

Commit

Permalink
media: aspeed: Fix return value check in aspeed_video_debugfs_create()
Browse files Browse the repository at this point in the history
In case of error, the function debugfs_create_file() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Fixes: 52fed10 ("media: aspeed: add debugfs")
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
  • Loading branch information
Zheng Yongjun authored and intel-lab-lkp committed Nov 25, 2022
1 parent 1e284ea commit 6ef6de2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/media/platform/aspeed/aspeed-video.c
Expand Up @@ -1780,10 +1780,12 @@ static int aspeed_video_debugfs_create(struct aspeed_video *video)
debugfs_entry = debugfs_create_file(DEVICE_NAME, 0444, NULL,
video,
&aspeed_video_debugfs_ops);
if (!debugfs_entry)
if (IS_ERR(debugfs_entry)) {
aspeed_video_debugfs_remove(video);
return ERR_PTR(debugfs_entry);
}

return !debugfs_entry ? -EIO : 0;
return 0;
}
#else
static void aspeed_video_debugfs_remove(struct aspeed_video *video) { }
Expand Down

0 comments on commit 6ef6de2

Please sign in to comment.