From: Zheng Yongjun <zhengyongjun3@huawei.com>
To: <eajames@linux.ibm.com>, <mchehab@kernel.org>,
<linux-media@vger.kernel.org>, <openbmc@lists.ozlabs.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-aspeed@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>
Cc: <joel@jms.id.au>, <andrew@aj.id.au>
Subject: [PATCH v2] media: aspeed: Fix return value check in aspeed_video_debugfs_create()
Date: Sat, 26 Nov 2022 02:28:13 +0000 [thread overview]
Message-ID: <20221126022813.57372-1-zhengyongjun3@huawei.com> (raw)
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: 52fed10ad756 ("media: aspeed: add debugfs")
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
v2:
- change return error code from ERR_PTR to PTR_ERR.
drivers/media/platform/aspeed/aspeed-video.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/aspeed/aspeed-video.c b/drivers/media/platform/aspeed/aspeed-video.c
index 20f795ccc11b..0113e6bc836f 100644
--- a/drivers/media/platform/aspeed/aspeed-video.c
+++ b/drivers/media/platform/aspeed/aspeed-video.c
@@ -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 PTR_ERR(debugfs_entry);
+ }
- return !debugfs_entry ? -EIO : 0;
+ return 0;
}
#else
static void aspeed_video_debugfs_remove(struct aspeed_video *video) { }
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2022-11-26 2:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-26 2:28 Zheng Yongjun [this message]
2022-11-26 17:25 ` [PATCH v2] media: aspeed: Fix return value check in aspeed_video_debugfs_create() Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221126022813.57372-1-zhengyongjun3@huawei.com \
--to=zhengyongjun3@huawei.com \
--cc=andrew@aj.id.au \
--cc=eajames@linux.ibm.com \
--cc=joel@jms.id.au \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=openbmc@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).