spi-dw-core.c: Fix error checking for debugfs_create_dir
PATCH 1/1 spi-dw-core.c: Fix error checking for debugfs_create_dir
This patch fixes the error checking in spi-dw-core.c in debugfs_create_dir. The correct way to check if an error occurred is 'IS_ERR' inline function.
Signed-off-by Osama Muhammad <[email protected]>
--- drivers/spi/spi-dw-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-dw-core.c +1 -1
@@ -63,7 +63,7 @@ static int dw_spi_debugfs_init(struct dw_spi *dws)snprintf (name,32 ,"dw_spi%d" , dws->master->bus_num); dws->debugfs =debugfs_create_dir (name,NULL ); -if (!dws->debugfs) +if (IS_ERR (dws->debugfs))return -ENOMEM ; dws->regset.regs = dw_spi_dbgfs_regs;
Signature · 1 line
2.34.1
Hi Osama
Quoted 3 lines · Osama Muhammad
This patch fixes the error checking in
spi-dw-core.cindebugfs_create_dir. The correct way to check if an error occurred is 'IS_ERR' inline function.
AFAICS a correct way to fix this would be to drop the errors check from the implementation and convert the dw_spi_debugfs_init() function to returning void. DebugFS kernel API is designed in a way for the kernel to safely ignore the errors happening during the DebugFS nodes creation. See
for details.
-Serge(y)
Quoted 22 lines
Signed-off-by Osama Muhammad <[email protected]>--- drivers/spi/spi-dw-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/spi/spi-dw-core.c +1
-1@@ -63,7 +63,7 @@ static int dw_spi_debugfs_init(struct dw_spi *dws)snprintf (name,32 ,"dw_spi%d" , dws->master->bus_num); dws->debugfs =debugfs_create_dir (name,NULL ); -if (!dws->debugfs) +if (IS_ERR (dws->debugfs))return -ENOMEM ; dws->regset.regs = dw_spi_dbgfs_regs;Signature · 1 line
2.34.1