All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: unisys: Properly test debugfs_create_dir() return values
@ 2022-03-22  8:38 Fabio M. De Francesco
  2022-03-22  8:47 ` Greg Kroah-Hartman
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Fabio M. De Francesco @ 2022-03-22  8:38 UTC (permalink / raw)
  To: David Kershner, Greg Kroah-Hartman, sparmaintainer,
	linux-staging, linux-kernel
  Cc: Fabio M. De Francesco

debugfs_create_dir() returns a pointers to a dentry objects. On failures
it returns errors. Currently the values returned to visornic_probe()
seem to be tested for being equal to NULL in case of failures.

Properly test with "if (IS_ERR())" and then assign the correct error 
value to the "err" variable.

Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
 drivers/staging/unisys/visornic/visornic_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/unisys/visornic/visornic_main.c b/drivers/staging/unisys/visornic/visornic_main.c
index 643432458105..58d03f3d3173 100644
--- a/drivers/staging/unisys/visornic/visornic_main.c
+++ b/drivers/staging/unisys/visornic/visornic_main.c
@@ -1922,11 +1922,11 @@ static int visornic_probe(struct visor_device *dev)
 	/* create debug/sysfs directories */
 	devdata->eth_debugfs_dir = debugfs_create_dir(netdev->name,
 						      visornic_debugfs_dir);
-	if (!devdata->eth_debugfs_dir) {
+	if (IS_ERR(devdata->eth_debugfs_dir)) {
 		dev_err(&dev->device,
 			"%s debugfs_create_dir %s failed\n",
 			__func__, netdev->name);
-		err = -ENOMEM;
+		err = PTR_ERR(devdata->eth_debugfs_dir);
 		goto cleanup_register_netdev;
 	}
 
-- 
2.34.1


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

end of thread, other threads:[~2022-03-29 17:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22  8:38 [PATCH] staging: unisys: Properly test debugfs_create_dir() return values Fabio M. De Francesco
2022-03-22  8:47 ` Greg Kroah-Hartman
2022-03-24  9:20   ` Fabio M. De Francesco
2022-03-22  8:48 ` Greg Kroah-Hartman
2022-03-22  8:49 ` Dan Carpenter
2022-03-22  8:55   ` Dan Carpenter
2022-03-22  9:09   ` Fabio M. De Francesco
2022-03-29 17:00 ` Fabio M. De Francesco
2022-03-29 17:46   ` Dan Carpenter

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.