[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220322083858.16887-1-fmdefrancesco@gmail.com>
Date: Tue, 22 Mar 2022 09:38:58 +0100
From: "Fabio M. De Francesco" <fmdefrancesco@...il.com>
To: David Kershner <david.kershner@...sys.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
sparmaintainer@...sys.com, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Cc: "Fabio M. De Francesco" <fmdefrancesco@...il.com>
Subject: [PATCH] staging: unisys: Properly test debugfs_create_dir() return values
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@...il.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
Powered by blists - more mailing lists