All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] media: aspeed: Fix return value check in aspeed_video_debugfs_create()
@ 2022-11-26  2:28 ` Zheng Yongjun
  0 siblings, 0 replies; 6+ messages in thread
From: Zheng Yongjun @ 2022-11-26  2:28 UTC (permalink / raw)
  To: eajames, mchehab, linux-media, openbmc, linux-arm-kernel,
	linux-aspeed, linux-kernel
  Cc: joel, andrew

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2] media: aspeed: Fix return value check in aspeed_video_debugfs_create()
@ 2022-11-26  2:28 ` Zheng Yongjun
  0 siblings, 0 replies; 6+ messages in thread
From: Zheng Yongjun @ 2022-11-26  2:28 UTC (permalink / raw)
  To: eajames, mchehab, linux-media, openbmc, linux-arm-kernel,
	linux-aspeed, linux-kernel
  Cc: joel, andrew

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2] media: aspeed: Fix return value check in aspeed_video_debugfs_create()
@ 2022-11-26  2:28 ` Zheng Yongjun
  0 siblings, 0 replies; 6+ messages in thread
From: Zheng Yongjun @ 2022-11-26  2:28 UTC (permalink / raw)
  To: eajames, mchehab, linux-media, openbmc, linux-arm-kernel,
	linux-aspeed, linux-kernel
  Cc: andrew, joel

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] media: aspeed: Fix return value check in aspeed_video_debugfs_create()
  2022-11-26  2:28 ` Zheng Yongjun
  (?)
@ 2022-11-26 17:25   ` Andrew Lunn
  -1 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2022-11-26 17:25 UTC (permalink / raw)
  To: Zheng Yongjun
  Cc: eajames, mchehab, linux-media, openbmc, linux-arm-kernel,
	linux-aspeed, linux-kernel, joel, andrew

On Sat, Nov 26, 2022 at 02:28:13AM +0000, Zheng Yongjun wrote:
> 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>

Please see:

https://patchwork.kernel.org/project/linux-wireless/patch/20200429101526.GA2094124@kroah.com/

and there are other examples. Just delete all the checks.

	Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] media: aspeed: Fix return value check in aspeed_video_debugfs_create()
@ 2022-11-26 17:25   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2022-11-26 17:25 UTC (permalink / raw)
  To: Zheng Yongjun
  Cc: eajames, mchehab, linux-media, openbmc, linux-arm-kernel,
	linux-aspeed, linux-kernel, joel, andrew

On Sat, Nov 26, 2022 at 02:28:13AM +0000, Zheng Yongjun wrote:
> 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>

Please see:

https://patchwork.kernel.org/project/linux-wireless/patch/20200429101526.GA2094124@kroah.com/

and there are other examples. Just delete all the checks.

	Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] media: aspeed: Fix return value check in aspeed_video_debugfs_create()
@ 2022-11-26 17:25   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2022-11-26 17:25 UTC (permalink / raw)
  To: Zheng Yongjun
  Cc: linux-aspeed, andrew, openbmc, eajames, linux-kernel, joel,
	mchehab, linux-arm-kernel, linux-media

On Sat, Nov 26, 2022 at 02:28:13AM +0000, Zheng Yongjun wrote:
> 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>

Please see:

https://patchwork.kernel.org/project/linux-wireless/patch/20200429101526.GA2094124@kroah.com/

and there are other examples. Just delete all the checks.

	Andrew

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-28  1:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-26  2:28 [PATCH v2] media: aspeed: Fix return value check in aspeed_video_debugfs_create() Zheng Yongjun
2022-11-26  2:28 ` Zheng Yongjun
2022-11-26  2:28 ` Zheng Yongjun
2022-11-26 17:25 ` Andrew Lunn
2022-11-26 17:25   ` Andrew Lunn
2022-11-26 17:25   ` Andrew Lunn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.